I've been a fan of this forum for a very long time and decided to register and ask for your wisdom on the problem that's been bugging me for a while.
Quite often I come across some "cartoon" images (images that used to contain very few unique colors) that someone has (needlessly) compressed into jpegs and now the image has artifacts.
For example, take this image:

You can notice speckling around lines and the colors around lines are now blended as well. The original only had 6 colors and now the JPG has thousands.
Using something as simple as:
Code: Select all
convert input.jpg -dither None -colors 16 output.png

If you use less colors, the white in eyes will not show up (they will be blue) because IM doesn't seem to have an option to restrict palette to only the most frequent colors in an image. The background blue color was also shifted. There are also problems with speckling around lines that are quite obvious when you zoom in:

and there is a "double border" around some lines as can be seen in the following crop (notice the dark blue line below black line):

How would you go about restoring this image and converting it to a small PNG so that all these problems are minimized?
Thank you so much for any insights and thank you for all the recipes that always get posted on here!