Photo to cartoon script
Re: Photo to cartoon script
I was trying to create an "Andy Warhol" type effect last year but did not finish it. Basicly I was selecting a colour, setting a fuzz and replacing that range with one colour using a mask.
Re: Photo to cartoon script
Bonzo, I like your example. Do you remember the exact code you were using? Were you using manual coloring, or did you have a good way to map "toonish" colors?
Re: Photo to cartoon script
Below is the code I used; it is a mess as I didn't take it any further - I was also working with a face hence the strange names/references. It is creating simple coloured areas from a colour range and changing the rest of the image to transparent. These coloured areas are then overlapped to create the final image.
If you try it with the image I posted you will see the different masks; this was a step on from this example http://www.rubblewebs.co.uk/imagemagick ... =green.jpg
I also wrote some other code to pick out the colours but again I didn't finish it:
http://www.rubblewebs.co.uk./imagemagic ... s/imap.php
If you try it with the image I posted you will see the different masks; this was a step on from this example http://www.rubblewebs.co.uk/imagemagick ... =green.jpg
I also wrote some other code to pick out the colours but again I didn't finish it:
http://www.rubblewebs.co.uk./imagemagic ... s/imap.php
Code: Select all
<?php
// Resized the original image
exec("convert butterfly_sunflower_1.jpg -resize 400x300! reduced_colours1.jpg");
exec("convert reduced_colours1.jpg -matte ( +clone -fuzz 20% -transparent rgb(90,135,202) ) -compose DstOut -composite hat_mask.png");
exec("composite -compose Dst_in hat_mask.png -size 400x300 xc:blue green_hat.gif");
// Change the black to transparent
exec("convert green_hat.gif -transparent black black_trans.png");
exec("convert reduced_colours1.jpg -matte ( +clone -fuzz 20% -transparent rgb(196,144,0) ) -compose DstOut -composite lips_mask.png");
exec("composite -compose Dst_in lips_mask.png -size 400x300 xc:yellow red_lips.gif");
// Change the black to transparent
exec("convert red_lips.gif -transparent black red_trans.png");
exec("convert reduced_colours1.jpg -fuzz 12% -transparent rgb(68.81,27) face_mask.png");
exec("composite -compose DstOut face_mask.png -size 400x300 xc:green pink_face.png");
// Change the black to transparent
exec("convert pink_face.png -transparent black pink_trans.png");
// Composite the images
exec("convert pink_trans.png black_trans.png -composite red_trans.png -composite final.jpg");
?>
<img src="hat_mask.png">
<img src="green_hat.gif">
<img src="black_trans.png">
<img src="lips_mask.png">
<img src="red_lips.gif">
<img src="red_trans.png">
<img src="face_mask.png">
<img src="pink_face.png">
<img src="pink_trans.png">
<img src="final.jpg">
<img src="reduced_colours1.jpg">
Re: Photo to cartoon script
Has anyone done any more on this? I'm trying to create one but failing badly at knowing what to do.
The best I have so far is..
Sorry about slow site btw..
http://crm.primaryt.co.uk/ppix/test12.php & http://crm.primaryt.co.uk/ppix/test10.php
The best I have so far is..
Sorry about slow site btw..
http://crm.primaryt.co.uk/ppix/test12.php & http://crm.primaryt.co.uk/ppix/test10.php
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Photo to cartoon script
It can be done, and some methods are on the web. one method called rotoscope, as been used to generate a flat cartoon like effect from film in the movie of Phillip K Dick's novel 'Scanner Darkly'.metaph wrote:Has anyone given any thought as to how to cartoonize a digital photo using ImageMagick? I'd like to script a bunch of these.
I have been playing with blending together reducing the colors, and using paint, charcoal and (optionally) the sketch filter. I tried using some colormaps and posterize but didn't like the results as much.
Typically many of the area segmentation methods used for real images can also be used for cartoon like effects.
Please search and explore and if you find something let us know and people of the forum may be ablet to help further.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Photo to cartoon script
see G'MIC (free imaging app that claims to have that as one of many options. seems to be built on IM)
http://gmic.sourceforge.net/
http://gmic.sourceforge.net/documentation.shtml (-warhol)
http://gmic.sourceforge.net/gallery.shtml
Also search google (warhol effect) --- plenty of methods and examples (just from the first 3 pages of results)
http://www.tutorialized.com/view/tutori ... ffect/8881
http://www.ransen.com/Repligator/warhol.htm
http://www.ransen.com/repligator/Andy-Warhol-Effect.htm
http://www.heron-productions.com/warholeffect.html
http://focalstudios.wordpress.com/2008/ ... ol-effect/
http://www.webdesign.org/web/photoshop/ ... 10254.html
http://broadcast.oreilly.com/2009/06/de ... the-a.html
http://www.alt-web-design.com/photo-tut ... ffect.html
http://www.10e20.com/blog/2007/08/22/th ... -tutorial/
http://www.scribd.com/doc/9668415/PSD-Warhol-Effect
http://www.tutorialkit.com/tutorials/Vi ... 65802.html
http://www.retouchpro.com/forums/photo- ... fects.html
http://gmic.sourceforge.net/
http://gmic.sourceforge.net/documentation.shtml (-warhol)
http://gmic.sourceforge.net/gallery.shtml
Also search google (warhol effect) --- plenty of methods and examples (just from the first 3 pages of results)
http://www.tutorialized.com/view/tutori ... ffect/8881
http://www.ransen.com/Repligator/warhol.htm
http://www.ransen.com/repligator/Andy-Warhol-Effect.htm
http://www.heron-productions.com/warholeffect.html
http://focalstudios.wordpress.com/2008/ ... ol-effect/
http://www.webdesign.org/web/photoshop/ ... 10254.html
http://broadcast.oreilly.com/2009/06/de ... the-a.html
http://www.alt-web-design.com/photo-tut ... ffect.html
http://www.10e20.com/blog/2007/08/22/th ... -tutorial/
http://www.scribd.com/doc/9668415/PSD-Warhol-Effect
http://www.tutorialkit.com/tutorials/Vi ... 65802.html
http://www.retouchpro.com/forums/photo- ... fects.html
Re: Photo to cartoon script
I was wondering if this could be done with imagemagick, not a gui. I will check out gmic though
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Photo to cartoon script
Forget gmic. the download TAR does not see to contain any code, and seems to be a wrapper around some other library they have not even bothered to mention in the INSTALL, README, Downloads, or on the page itself!!!!!
Of course the rest of the site is in French, which makes it doubly hard!
I was interesting in looking at some of their operators, and even the 'open-source' interpretor.
I can find neither!
I have no idea how they expect anyone else to do it if an experienced programmer fails!!!
Fred, most of your references was a gimp search for the 'Andy Worhol' effect, which is not 'cartoonizing' an image.
Of course the rest of the site is in French, which makes it doubly hard!
I was interesting in looking at some of their operators, and even the 'open-source' interpretor.
I can find neither!
I have no idea how they expect anyone else to do it if an experienced programmer fails!!!
Fred, most of your references was a gimp search for the 'Andy Worhol' effect, which is not 'cartoonizing' an image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Photo to cartoon script
Anthony,
Bonzo mentioned Andy Warhol effect above and the first user was asking how to do it. So I did a google search and reported my results. I thought that was what the original user was ultimately getting at as he responded positively to Bonzo's reply.
I am sure there are many ways to "cartoon" an image. Just saying "cartoon" does not give anyone any idea what that means and he provided no visual results or references. Is there a standard technique for what "cartoon" means to most people?
One day I might try to make a script to do the Warhol effect in IM. But it seems to be very manually oriented on a picture by picture case and there seem to be numerous ways to do it by the variations discussed in the google search results.
Sorry about the G'MIC. But I have never tried it. I did contact the originator once, but did not get much help. The docs and examples seemed to be very impressive.
The original reference was on the IM site at
http://www.imagemagick.org/script/links.php
perhaps(???) it should be removed, if there is no code to install or it is not clear how to do it?
Bonzo mentioned Andy Warhol effect above and the first user was asking how to do it. So I did a google search and reported my results. I thought that was what the original user was ultimately getting at as he responded positively to Bonzo's reply.
I am sure there are many ways to "cartoon" an image. Just saying "cartoon" does not give anyone any idea what that means and he provided no visual results or references. Is there a standard technique for what "cartoon" means to most people?
One day I might try to make a script to do the Warhol effect in IM. But it seems to be very manually oriented on a picture by picture case and there seem to be numerous ways to do it by the variations discussed in the google search results.
Sorry about the G'MIC. But I have never tried it. I did contact the originator once, but did not get much help. The docs and examples seemed to be very impressive.
The original reference was on the IM site at
http://www.imagemagick.org/script/links.php
perhaps(???) it should be removed, if there is no code to install or it is not clear how to do it?
Re: Photo to cartoon script
haha Anthony, I got gmic going, it was a right mission. I guess I did okay eh
Anyways, it doesn't change from the fact it sucks..
My definition of Cartoon is to have a few pixel border to emphasize lines of the face then to quantize (I think) the amount of colours..
BeFunky has a good example online but BeFunky as a company seem to fail.
Anyways, it doesn't change from the fact it sucks..
My definition of Cartoon is to have a few pixel border to emphasize lines of the face then to quantize (I think) the amount of colours..
BeFunky has a good example online but BeFunky as a company seem to fail.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Photo to cartoon script
What were your GMIC dependencies?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Photo to cartoon script
johnymac wrote:I blogged about how I accomplished it
http://www.mclear.co.uk/2009/06/how-to- ... -turn.html
Curious, but none of these look like what I would expect for a "cartoon". Are any of these what you really wanted? Is it more like what one sees from the cartoon example at BeFunky?
Can you post the same image with your attempts using IM? And any comments about what IM options seem to produce the closest to what you are looking for in a "cartoon".
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Photo to cartoon script
Just playing around. I tried: 1) +dither -posterize 6 and 2) -quantize RGB +dither -colors 32. Here are the comparisons with the originals (ordered as original, posterize, colors versions):
I think I slightly prefer the -colors 32 to the posterize 6.
I think I slightly prefer the -colors 32 to the posterize 6.
Last edited by fmw42 on 2009-06-18T12:29:59-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Photo to cartoon script
johnymac wrote:Has anyone done any more on this? I'm trying to create one but failing badly at knowing what to do.
The best I have so far is..
Sorry about slow site btw..
http://crm.primaryt.co.uk/ppix/test12.php & http://crm.primaryt.co.uk/ppix/test10.php
Where is the original?