Fred's ImageMagick Scripts
|
Creates a cartoon-like appearance to an image. |
last modified: November 27, 2011
|
USAGE: cartoon [-m method] [-n numcolors] [-i imagefilter] [-e edgefilter] [-p pctedges] [-s smooth] infile outfile
-m .... method .......... method of color reduction; choices are 1 or 2; PURPOSE: To create a cartoon-like appearance to an image. DESCRIPTION: CARTOON creates a cartoon-like appearance to an image. The image is color reduced to try to achieve the desired number of colors. There are two methods to do this. The first is not terribly sensitive to the desired number of colors. Values in the range of about 6-14 generally produce the same result. But the image can be a bit noisy/grainy, so post smoothing is generally needed. The second produces different results for different desired number of colors and generally is not as noise sensitive. Edges can then be superimposed onto the image. The edges are produced by a gradient edge detector. ARGUMENTS: -m method ... METHOD is the color reduction method. The choices are 1 or 2. Method 1 uses the IM -colors function channel-by-channel. Method 2 computes a -fx formula and is applied via -clut. The default=1 -n numcolors ... NUMCOLORS is the desired number of reduced colors. Values are integers>0. The default=10. -i imagefilter ... IMAGEFILTER is the size of a median filter that will be applied to the image before reducing colors. Values are integers>=0. The default=2. -e edgefilter ... EDGEFILTER is the size of a median filter that will be applied to a grayscale version of the image before extracting edges. Values are integers>=0. The default=2. -p pctedges ... PCTEDGES is the percentage of the edges from the gradient edge extraction from the grayscale image to overlay on the image. Values are 0<=integer<=100. The default=75. -s smooth ... SMOOTH is the amount of (-blur) smoothing to apply to the color reduced image before the edges are overlayed. Values are floats>=0. The default=1. CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk. |
|
Image 1 -- Variation In Edge Filtering |
||
|
Original |
Arguments: |
Arguments: |
|
|
|
|
Image 2 -- Variation In Method |
||
|
Original |
Arguments: |
Arguments: |
|
|
|
|
Image 2 -- Variation In Method 2 Number Of Colors |
||
|
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
Image 3 |
||
|
Original |
Arguments: |
|
|
|
|
|
What the script does is as follows:
This is equivalent to the following IM commands
|