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.