From 0cf83c0dc85ecdbfa5105d2d4639ded8c6ec72e0 Mon Sep 17 00:00:00 2001 From: Mat Groves Date: Mon, 22 Apr 2024 14:27:18 +0100 Subject: [PATCH] chore(compress): fix webp to not compress from compressed PNG (#11) * - add skip property and skipChildren - fixed json and test - fixed texture packer still creating individual images - ensure output is removed if the cache key changes * -test tweak - fix compressed pngs not working * fix rotation on texture packer * - modify cache-buster to use hash - remove spineAtlasMipmap from mipmap-compress - fix png compression - add spine package * pr feedback * fix install * fix tests * fix test * note * feedback * fix fs * fix up metadata * remove dup code * fix webp compression --------- Co-authored-by: Zyie <24736175+Zyie@users.noreply.github.com> --- packages/mipmap-compress/src/utils/compressSharp.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/mipmap-compress/src/utils/compressSharp.ts b/packages/mipmap-compress/src/utils/compressSharp.ts index b72b74c..f0ebb4c 100644 --- a/packages/mipmap-compress/src/utils/compressSharp.ts +++ b/packages/mipmap-compress/src/utils/compressSharp.ts @@ -1,6 +1,5 @@ import type { AvifOptions, WebpOptions, JpegOptions, PngOptions } from 'sharp'; import type { MipmapCompressImageData, CompressOptions } from '../mipmapCompress'; -import sharp from 'sharp'; export async function compressSharp( image: MipmapCompressImageData, @@ -9,14 +8,10 @@ export async function compressSharp( { const compressed: MipmapCompressImageData[] = []; - let sharpImage = image.sharpImage; + const sharpImage = image.sharpImage; if (image.format === '.png' && options.png) { - // optimising the PNG image and using that as the source of the WebP and AVIF images - // will result in a smaller file size and increase the speed of the compression. - sharpImage = sharp(await image.sharpImage.png({ ...options.png as PngOptions, force: true }).toBuffer()); - compressed.push({ format: '.png', resolution: image.resolution,