Skip to content

Commit

Permalink
chore(compress): fix webp to not compress from compressed PNG (#11)
Browse files Browse the repository at this point in the history
* - 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 <[email protected]>
  • Loading branch information
GoodBoyDigital and Zyie authored Apr 22, 2024
1 parent 8657b72 commit 0cf83c0
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions packages/mipmap-compress/src/utils/compressSharp.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 0cf83c0

Please sign in to comment.