Fred's ImageMagick Scripts
My scripts are available free of charge for non-commercial use. If you redistribute or incorporate any of these scripts into other free applications, you may use my scripts by simply referencing my name and this web page: Fred Weinhaus and http://www.fmwconcepts.com/imagemagick/index.html For use of my scripts in commercial use or non-free applications, please contact me for
licensing arrangements. Usage, whether stated in script or not, is also subject to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php |
|
Creates either a spectrum or histogram of the colors in an image. |
last modified: October 06, 2011
|
USAGE: spectrumhist [-t type] [-s sort] [-w width] [-h height] [-m magnify] [-c colors] infile outfile
-t ... type ...... type of output; histogram (h) or spectrum (s); PURPOSE: To create either a spectrum or histogram of the colors in an image. DESCRIPTION: SPECTRUMHIST creates either a color spectrum or histogram of the colors in an image. This is a bar graph of the exact colors rather than a histogram by channels. The graph may be sorted either by count or by hue. ARGUMENTS: -t type ... TYPE of output. Choices are histogram (h) or spectrum (s). The default=histogram -s sort ... SORT is the mode of sorting the colors. The choices are: count (c), hue (h), sat (s) for saturation, lum (l) for luminosity (i.e. intensity), rgb (r) or bgr (b). The default=hue -w width ... WIDTH of the bars in the bar chart. Values are integers>0. The default=1 -h height ... HEIGHT of the output image. Values are integer>0. The default=100 -m magnify ... MAGNIFY is the magnification factor for count scaling. This scales the height of each bar of the histogram, but does not affect the height of the image. Any bar that is taller than the image will be clipped. This is not relevant to type=spectrum. Values are integers>0. The default=1 -c colors ... COLORS is the number of colors desired for color reduction in the input image. Values are 0<integer<=256. The default=256. If the image has fewer colors than selected, the actual number of colors will be used. 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. |
|
Example 1 |
|
|
Original |
|
|
|
|
|
Arguments: |
Arguments: |
|
|
|
Arguments: |
Arguments: |
|
|
|
Example 2 |
|
|
Original |
|
|
|
|
Arguments: |
Arguments: |
|
|
|
Arguments: |
Arguments: |
|
|
|
Arguments: |
Arguments: |
|
|
|
Arguments: |
Arguments: |
|
|
|
Example 3 |
|
|
Original |
|
|
|
|
Arguments: |
Arguments: |
|
|
|
Arguments: |
Arguments: |
|
|
|
Arguments: |
Arguments: |
|
|
|
Arguments: |
Arguments: |
|
|
|
Example 4 |
|
|
Original |
|
|
|
|
Arguments: |
Arguments: |
|
|
|
Arguments: |
Arguments: |
|
|
|
Arguments: |
Arguments: |
|
|
|
Arguments: |
Arguments: |
|
|
|
Example 5 -- Spectrum vs Sort |
|
Original |
|
|
Arguments: |
|
|
Arguments: |
|
|
Arguments: |
|
|
Arguments: |
|
|
Arguments: |
|
|
Arguments: |
|
|
Example 6 -- Spectrum vs Sort |
|
Original |
|
|
Arguments: |
|
|
Arguments: |
|
|
Arguments: |
|
|
Arguments: |
|
|
Arguments: |
|
|
Arguments: |
|
|
What the script does is as follows for the case of type=histogram and sort=hue:
This is equivalent to the following IM commands
|