Sharp wrapper that parses url parameters.
ESM
import { ImageZ } from '@vgarciaf/image-z';
import { readFileSync } from 'fs';
const image = readFileSync('./src/__tests__/test.jpg').toString('base64');
const transformedImage = (await ImageZ.from(image).transform('w_100,h_100')).response();
CommonJS
const { ImageZ } = require('@vgarciaf/image-z');
const { readFileSync } = require('fs');
async function main() {
const image = readFileSync('./src/__tests__/test.jpg').toString('base64');
const transformedImage = (await ImageZ.from(image).transform('w_100,h_100')).response();
}
main();
Parameter | Description | Example |
---|---|---|
w | Width | w_100 |
h | Height | h_100 |
f | Fit | f_fill |
bg | Background | bg_#ffffff |
'contain'
'cover'
'fill'
'inside'
'outside'