@vgarciaf/image-z
v0.1.10
Published
Sharp wrapper that parses url parameters.
Downloads
2
Readme
Image Z
Sharp wrapper that parses url parameters.
Usage
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();
Parameters
| Parameter | Description | Example | | --- | --- | --- | | w | Width | w_100 | | h | Height | h_100 | | f | Fit | f_fill | | bg | Background | bg_#ffffff |
Fit
'contain'
'cover'
'fill'
'inside'
'outside'