fix(core): update

This commit is contained in:
Philipp Kunz 2023-12-03 23:30:58 +01:00
parent 8566c5f57f
commit 33e8ba5f30
2 changed files with 5 additions and 1 deletions

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartjimp', name: '@push.rocks/smartjimp',
version: '1.0.15', version: '1.0.16',
description: 'a tool fr working with images in TypeScript' description: 'a tool fr working with images in TypeScript'
} }

View File

@ -5,6 +5,7 @@ export interface IAssetVariation {
format?: 'avif' | 'webp' | 'png'; format?: 'avif' | 'webp' | 'png';
width?: number; width?: number;
height?: number; height?: number;
invert?: boolean;
} }
export interface ISmartJimpOptions { export interface ISmartJimpOptions {
@ -80,6 +81,9 @@ export class SmartJimp {
if (assetVariationArg.width || assetVariationArg.height) { if (assetVariationArg.width || assetVariationArg.height) {
jimpImage = jimpImage.resize(assetVariationArg.width, assetVariationArg.height); jimpImage = jimpImage.resize(assetVariationArg.width, assetVariationArg.height);
} }
if (assetVariationArg.invert) {
jimpImage = jimpImage.invert();
}
switch (assetVariationArg.format) { switch (assetVariationArg.format) {
case 'png': case 'png':
return await jimpImage.getBufferAsync(jimp.MIME_PNG); return await jimpImage.getBufferAsync(jimp.MIME_PNG);