Reputation: 4664
I am trying to "simplify" an image with ImageMagick by converting it to gray-scale and using an oil paint filter group larger parts that seem to be equal, e.g. clouds, grassland...
My source image for the example is:
(from tmdb: http://www.themoviedb.org/movie/122-the-lord-of-the-rings-the-return-of-the-king)
When using IrfanView for Windows, I do the following steps:
This is the resulting image (replaced lower color with floodfill, perfect!):
It's exactly how I want it (maybe some parameters need tuning). When I try to make the same result with ImageMagick, I hacked this:
convert -monitor lotr2.jpg +dither -quantize gray -colors 8 \
-paint 6 lotr_oilpaint.jpg
But no matter what I am trying, there is a really awful amount of noise in the image. I tried the mode filter and it helped a little bit by removing some noise but it seems to add some noise in other parts.
It's far away from the IrfanView solution, generating really solid areas of the same color which can be flood filled with no problem.
Upvotes: 2
Views: 866
Reputation: 90263
Had a quick shot at your challenge... this is the first command I tried:
convert \
https://i.sstatic.net/6iX53.jpg \
-colorspace gray \
-colors 16 \
-paint 8 \
6iX53.png
As you can see, I skipped the -floodfill +X+Y red
parameter for now...
Here is my result:
It looks already rather close to yours. It contains 10 different colors:
identify -format '%k\n' 6iX53.png
10
To successfully do a -floodfill
when there is some 'noise' in the image, you can add a -fuzz X%
-factor to the command. So let's try that with -fuzz 3%
:
convert \
https://i.sstatic.net/6iX53.jpg \
-colorspace gray \
-colors 16 \
-paint 8 \
-fuzz 3% \
-fill red \
-floodfill +1+438 '#030303' \
6iX53-floodfilled.png
Result:
Maybe by playing with some of the parameters I used, you can get the result closer to what you want...
Upvotes: 3