Skip to content

Commit

Permalink
🔧 Use fit inside to resize nft image
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Feb 8, 2023
1 parent d843c54 commit c82adc5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/util/api/likernft/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { getISCNPrefixDocName } from '.';
import { getNFTISCNData, getNFTClassDataById } from '../../cosmos/nft';
import { ValidationError } from '../../ValidationError';

export const DEFAULT_NFT_IMAGE_SIZE = 1280;
export const DEFAULT_NFT_IMAGE_WIDTH = 1280;
export const DEFAULT_NFT_IMAGE_HEIGHT = 768;

Expand All @@ -29,8 +30,9 @@ export async function getImageMask() {
const imgPath = path.join(__dirname, '../../../assets/book.png');
maskData = await sharp(imgPath)
.resize({
height: DEFAULT_NFT_IMAGE_HEIGHT,
width: DEFAULT_NFT_IMAGE_HEIGHT,
width: DEFAULT_NFT_IMAGE_SIZE,
height: DEFAULT_NFT_IMAGE_SIZE,
fit: 'inside',
})
.extractChannel('alpha')
.toBuffer();
Expand Down

0 comments on commit c82adc5

Please sign in to comment.