vseventer / sharp-cli

CLI for sharp.
MIT License
186 stars 20 forks source link

Specifying quality changes PNG file format to ISO Media #68

Closed kbrandwijk closed 2 years ago

kbrandwijk commented 2 years ago

Using sharp-cli@2.1.0:

❯ file logo.png
logo.png: PNG image data, 512 x 512, 8-bit/color RGBA, non-interlaced

❯ npx sharp-cli -i ./logo.png -o ./logo_opt.png
/.../logo_opt.png

❯ file logo_opt.png
logo_opt.png: PNG image data, 512 x 512, 8-bit/color RGBA, non-interlaced

❯ file logo_opt.png
logo_opt.png: PNG image data, 512 x 512, 8-bit/color RGBA, non-interlaced

❯ npx sharp-cli -i ./logo.png -o ./logo_opt80.png --quality 80
/.../logo_opt80.png

❯ file logo_opt80.png
logo_opt80.png: ISO Media
kbrandwijk commented 2 years ago

Additionally, I tried specifying --format input explicitly, which didn't help. Specifying --format png did, but that's not a solution for us (expo-optimize) because we encounter different input formats.

vseventer commented 2 years ago

Thanks for reporting - this looks like a bug where I forgot to add force: false to HEIF meaning this is actually quite a big problem.

vseventer commented 2 years ago

@kbrandwijk This has now been released as v2.1.1.

kbrandwijk commented 2 years ago

Awesome, I can confirm that fixes it!