vseventer/sharp-cli

Specifying quality changes PNG file format to ISO Media

Closed this issue · 4 comments

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

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.

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.

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

Awesome, I can confirm that fixes it!