kornelski / pngquant

Lossy PNG compressor — pngquant command based on libimagequant library
https://pngquant.org
Other
5.24k stars 485 forks source link

Images with large transparent fades result in stepped transparent images #130

Closed pixelschrubber closed 10 years ago

pixelschrubber commented 10 years ago

When converting images with large areas of colorfade to transparent pngquant will generate images with stepped parts of the semi-transparent color. Example: good Optimizing by using pngquant 2.0.1 with params "--nofs --speed 3" I get this result: bad Tried different params, same result. How could one keep the colored fade to transparent without steps?

kornelski commented 10 years ago

I can't reproduce it in the current version: 2.3

pixelschrubber commented 10 years ago

Thank you for your rapid response. I didn't expect that :-) I tested this on different environments (OSX, Ubuntu Linux) with the newest pngquant version 2.3.1. The libpng was old, but I built it again with 1.6.13. Afterwards I tested again and got the following results: Original image: fade-test Simple conversion (pngquant fade-test.png) resulted in fade-test-fs8.png (which looks fine): fade-test-fs8 Conversion without Floyd-Steinberg (pngquant --nofs fade-test.png) resulted in fade-test-or8.png: fade-test-or8 In the second converted image (fade-test-or8.png) one can see the different steps, which are generated. Is there a way of using the algorithm without Floyd-Steinberg but with a smooth gradient?

kornelski commented 10 years ago

No, the steps are a limitation of the file format. You can control amount of dithering with --floyd=0.5.

c9795e40-6677-11e4-8d6f-15b264113080-fs8

pixelschrubber commented 10 years ago

Thank you!