Display histogram
Display histogram
Is able Imagemagick to display information about the levels of an image? What would be amazing is displaying a graphic histogram...
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Display histogram
see http://www.imagemagick.org/Usage/files/#histogram
see also my unix bash script, histog, at the link below
see also my unix bash script, histog, at the link below
Re: Display histogram
Great!
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Display histogram
The "histogram" images comments contain the complete dump of the color counts in the image.
http://www.imagemagick.org/Usage/files/#histogram
If you don't want it you can tell IM to not generate that comment (and the time it takes to do this) using
-define histogram:unique-colors=false
http://www.imagemagick.org/Usage/files/#histogram
If you don't want it you can tell IM to not generate that comment (and the time it takes to do this) using
-define histogram:unique-colors=false
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Display histogram
Can I generate the histogram and invert its colors or give it a blueish tone with just one command? I'm using this command as part of an AutoHotkey script:
runwait, %comspec% /c d:\Imagemagick\convert %imageo% -separate -append -define histogram:unique-colors=false histogram:histogram1o.jpg ,,hide
runwait, %comspec% /c d:\Imagemagick\convert %imageo% -separate -append -define histogram:unique-colors=false histogram:histogram1o.jpg ,,hide
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Display histogram
You can do it with a pipe, e.g
convert rose: -separate -append -define histogram:unique-colors=false histogram:MIFF:- | convert - -negate histog.jpg
or with mpr (in memory image) as
convert \( rose: -separate -append -define histogram:unique-colors=false -write histogram:mpr:hist +delete \) \
mpr:hist -negate histog.jpg
see
http://www.imagemagick.org/Usage/files/#mpr
convert rose: -separate -append -define histogram:unique-colors=false histogram:MIFF:- | convert - -negate histog.jpg
or with mpr (in memory image) as
convert \( rose: -separate -append -define histogram:unique-colors=false -write histogram:mpr:hist +delete \) \
mpr:hist -negate histog.jpg
see
http://www.imagemagick.org/Usage/files/#mpr
Re: Display histogram
It's working here
I don't want to bother you, but you could save me some time investigating how to:
-give it a blue tone
-save it as a png with partial transparency
Much appreciated.
I don't want to bother you, but you could save me some time investigating how to:
-give it a blue tone
-save it as a png with partial transparency
Much appreciated.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Display histogram
Elapido wrote:It's working here
I don't want to bother you, but you could save me some time investigating how to:
-give it a blue tone
-save it as a png with partial transparency
Much appreciated.
What part do you want blue -- the histogram or the background? What part do you want transparent -- the histogram or the background
try this
convert \( rose: -separate -append -define histogram:unique-colors=false -write histogram:mpr:hist +delete \) \
mpr:hist -negate -fill blue -opaque black -transparent white histog.png
see
http://www.imagemagick.org/Usage/color_basics/#replace
Re: Display histogram
I'll try although I think this is more than enough for what I need:
convert 1.jpg -separate -append -define histogram:unique-colors=false histogram:MIFF:- | convert - -fill "#ddddff" -colorize 60% histogram1e.jpg
Thanks man.
convert 1.jpg -separate -append -define histogram:unique-colors=false histogram:MIFF:- | convert - -fill "#ddddff" -colorize 60% histogram1e.jpg
Thanks man.
Re: Display histogram
The only problem I'm having with histograms is that the graphics are too flat in some images (when they have much contrast), almost unreadable sometimes. Notice the difference between the histogram in Photoshop (left) and Imagemagick (right) for the same image. There are cases in which you just see an almost empty square. I wonder if this can be fixed somehow.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Display histogram
post a link to your image
or try adding -scale 100x50%! -threshold 50% before the output
unfortunately right now IM has no scale control or clip if a bin is too high on the histogram graph that I know about other than what I have suggested above.
You could process the histogram to modify any tall peaks to half height and then scale the graph down as above.
or try adding -scale 100x50%! -threshold 50% before the output
unfortunately right now IM has no scale control or clip if a bin is too high on the histogram graph that I know about other than what I have suggested above.
You could process the histogram to modify any tall peaks to half height and then scale the graph down as above.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Display histogram
Elapido wrote:Can I generate the histogram and invert its colors or give it a blueish tone with just one command?
YES the trick is to write the histogram output into a MPR: image store. Then read it back.
See MPR in IM Examples
http://www.imagemagick.org/Usage/files/#mpr
Here is one example that resizes the histogram result, using only one command..
Code: Select all
convert rose: -define histogram:unique-colors=false \
-write histogram:mpr:hgram +delete \
mpr:hgram -strip -resize 50% histogram_resized.gif
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/