[Solved] Downsizing image with large areas of same color
Posted: 2018-11-25T19:40:13-07:00
Hello,
I have a large, high-quality image of a flag that is generated from a TikZ drawing, created like so:
https://i.imgur.com/nWAXYa4.png
My goal is to turn this into a small (154x87) GIF. So far I have
(The final use case of this will see the image scaled to several additional smaller dimensions: 104x59, 42x24, and 25x14.)
Investigation with -unique-colors reveals that the original flag.png already only has 4 colors, but running it through -colors 4 makes the image smaller, so maybe that's still a good thing? Regardless, I still see the problematic behavior either way.
Here's the output from that resize: https://i.imgur.com/RR7Llex.gif. If you zoom in, you can see what I feel is unacceptably high levels of dithering in the solid yellow and red fields. I understand the need for some dithering around the curves/circles, but can't understand why it's happening out in the middle of the solid, unchanging color.
Am I overreacting to this? What parameters can I try in order to reduce this effect? So far, I have messed with -filter, -distort, and -dither without success, although these were certainly not exhaustive tests.
I have a large, high-quality image of a flag that is generated from a TikZ drawing, created like so:
Code: Select all
latexmk -pdf flag.tex
gs -dSAFER -dNOPAUSE -dBATCH -sDEVICE=png16m -sOutputFile=flag.png
My goal is to turn this into a small (154x87) GIF. So far I have
Code: Select all
magick flag.png -colors 4 pallet-flag.png
magick pallet-flag.png -resize 154x87 flag.gif
Investigation with -unique-colors reveals that the original flag.png already only has 4 colors, but running it through -colors 4 makes the image smaller, so maybe that's still a good thing? Regardless, I still see the problematic behavior either way.
Here's the output from that resize: https://i.imgur.com/RR7Llex.gif. If you zoom in, you can see what I feel is unacceptably high levels of dithering in the solid yellow and red fields. I understand the need for some dithering around the curves/circles, but can't understand why it's happening out in the middle of the solid, unchanging color.
Am I overreacting to this? What parameters can I try in order to reduce this effect? So far, I have messed with -filter, -distort, and -dither without success, although these were certainly not exhaustive tests.