Replies: 5 comments
-
Here is a possible approach. Windows BAT syntax. For bash, change line-ending caret ^ to backslash \, escape the parentheses \( and \), and don't double the percents %%.
This clones the image, and turns pixels that are more than 15% from a 10% gray into white. So x1.png is black where the image is new black, otherwise it is white. mpr:TRANS is the same but black on transparent. We CopyOpacity to the input, and blur it. This smooths the cyan, pink etc colours. Then we copy over that the black lines, making x3.png. The colours are not entirely smooth, so we do the same again, making x6.png. Finally, we reduce the image (in Lab colorspace) to 10 colours, making x7.png. |
Beta Was this translation helpful? Give feedback.
-
Interesting! Not perfect, but it accomplishes some things. So it seems you have to pick out parts of the image to work with individually before splicing them together? But eg. the background is still banded. The cyan colors are very different from all the other colors in the photo, so isn't there a way to clearly separate the basic colors, and "flatten" everything within that color domain that clearly isn't one of the other colors? Also, is there a vector tracer that supports colors? How about separating the black, resizing the remaining stuff (the colors) to eg. 10% to make the colors blend, then resize it up again. Then vectorize the black and add it on top of the colors (the black outlines hopefully covering jagged edges of the resized colors). Would something like that work? |
Beta Was this translation helpful? Give feedback.
-
Does ImageMagick have functionality for recognizing areas, ie. be more flexible in considering adjacent colors to be the same than distant ones, eg. to understand that colors on the desk should be brown even if there are black-ish dithering there? I thought a solution could be: Convert colors to HSL, do weighted kMeans with k=8 on the HSL dimensions, and use the colors that emerge. That must surely separate the colors properly? Or set a manual palette and force the converter to use that. Then the cyan shading must turn into a single cyan? When the alternative is yellow, etc. which is further away in the colorspace and will not be viable as candidates. |
Beta Was this translation helpful? Give feedback.
-
Yes, both of those can be used. See |
Beta Was this translation helpful? Give feedback.
-
Tried
Unless IM has an advanced "de-rasterize" filter or a "merge similar colors of continuous surfaces" filter, it seems necessary to hand-paint these areas prior to processing. |
Beta Was this translation helpful? Give feedback.
-
ImageMagick version
ImageMagick 7.1.1
Operating system, version and so on
macOS 14
Description
Consider the enclosed photo taken of a printed cartoon strip.
Is there a fully automated command line that can accomplish the following (without the need for human handwork ahead)?
Background information:
potrace
can vectorize, but then all color is lost (and work must be done to whiten darker colors first)pngquant
reduces colors intelligently, but often fails to unify large areas of similar colors in a satisfactory manner.Thanks in advance for kind help.
Beta Was this translation helpful? Give feedback.
All reactions