User Tools

Site Tools


imagemagick

How to

How do I export the histogramm data of an image?

If you want to have the typical brightness histogram generated from the gray scale image then use

convert source_file -colorspace Gray -define histogram:unique-colors=false -format %c histogram:info:- > destination.histogram

If you want to have the sum histogram (brightness) for all channels then use

convert source_file -separate -append -define hostogram:unique-colors=false -format %c histogram:info:- > destination.histogram

This will produce something like

   3581455: (  0,  0,  0) #000000 black
    261621: (  1,  1,  1) #010101 rgb(1,1,1)
    173629: (  2,  2,  2) #020202 rgb(2,2,2)
     95399: (  3,  3,  3) #030303 grey1
     80344: (  4,  4,  4) #040404 rgb(4,4,4)
       ...

The left most value shows how often this luminosity appears in the image. Greater numbers mean that the color occurs more often.

The numbers in braces are color values. If you exported the overall luminosity histogram like in the example above, then the intesity of each channel (red, green, blue) will have the same value.

imagemagick.txt · Last modified: 2015/05/17 17:44 (external edit)