Convert images to comic...

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
desputin

Convert images to comic...

Post by desputin »

Hi,
I'm working on a script for Imagemagick, in order to convert photos to comic-images. Up to now I have created the following script:
for x in *.png; do
convert -normalize -posterize 8 -despeckle -despeckle -despeckle -blur 1 -paint 2 $x $(basename $x .png)_comic.png
convert -posterize 9 -blur 18 -blur 4 -paint 3 -adaptive-sharpen 3 -edge 1 -negate -evaluate Multiply 1.5 -fx '(r+g+b)/3' +contrast -charcoal 1.1 -monochrome $x $(basename $x .png)_umriss.png
convert -transparent "#ffffff" -channel Alpha -evaluate Divide 1.5 -despeckle -paint 2 $(basename $x .png)_umriss.png $(basename $x .png)_umriss_trans.png
convert -paint 2 $(basename $x .png)_comic.png $(basename $x .png)_zusammen.png
composite $(basename $x .png)_umriss_trans.png $(basename $x .png)_zusammen.png $(basename $x .png)_final.png
rm -v *_comic.png *_umriss.png *_umriss_trans.png *_zusammen.png
done
I'm not quite satisfied with the result of this script...
Does anyone of you have suggestions to improve this script?

Best regards
Christopher
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert images to comic...

Post by fmw42 »

could you post a link of an input and output resulting image so others can try what you have done and see what you get and what changes can be made?
desputin

Re: Convert images to comic...

Post by desputin »

Hi,

sure. The convertet pictures you can find here:

http://www.christopherstark.de/extern/comic-effect.zip


Explanation of the script here:
// For Comic Effekt

convert -normalize -posterize 8 -despeckle -despeckle -despeckle -blur 1 -paint 2 picture.png comic.png

// Convert picture to Shapes

convert -posterize 9 -blur 18 -blur 4 -paint 3 -adaptive-sharpen 3 -edge 1 -negate -evaluate Multiply 1.5 -fx '(r+g+b)/3' +contrast -charcoal 1.1 -monochrome picture.png shapes.png

// Shapes to transparency:

convert -transparent "#ffffff" -channel Alpha -evaluate Divide 1.5 -despeckle -paint 2 shapes.png shapes_transparent.png

// compose shapes and image

composite shapes_transparent.png comic.png result.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert images to comic...

Post by fmw42 »

you might get some ideas from viewtopic.php?f=1&t=11140
Post Reply