Page 1 of 1

format for piping commands in imagemagick

Posted: 2008-10-07T15:21:21-07:00
by unnati
Hi

i just got imagemagick yesterday and i had a question about using it.
I have a jpg image that i want to turn to monochrome, then select a part of the image (probably by using -crop) and then obtain a histogram for the selected part.

Only i am not sure how this can be done. Can anyone please tell me how i can do this in imagemagick??

Thanks
Unnati

Re: format for piping commands in imagemagick

Posted: 2008-10-07T17:16:22-07:00
by anthony

Code: Select all

convert image.jpg +dither -threshold 50% \
      -crop 100x100+40+40 +repage \
      -format %c histogram:info:-
See
http://www.imagemagick.org/Usage/files/#histogram
http://www.imagemagick.org/Usage/quantize/#monochrome
http://www.imagemagick.org/Usage/quantize/#threshold

Re: format for piping commands in imagemagick

Posted: 2008-10-08T12:05:30-07:00
by unnati
Hi

thanks for that wonderful post...its really helpful
i have one more question though...this command gives me info about the least and the most intense pixels...but how do i get it to actually display the histogram and maybe even display the cropped area??

thanks
unnati

Re: format for piping commands in imagemagick

Posted: 2008-10-08T14:01:22-07:00
by fmw42
unnati wrote:Hi

thanks for that wonderful post...its really helpful
i have one more question though...this command gives me info about the least and the most intense pixels...but how do i get it to actually display the histogram and maybe even display the cropped area??

thanks
unnati
For histogram see http://www.imagemagick.org/Usage/files/#histogram

save cropped image:
convert image.jpg +dither -threshold 50% -crop 100x100+40+40 +repage cropped_image.jpg

generate histogram image:
convert cropped_image.jpg histogram:cropped_image_histogram.gif

display cropped image:
display cropped_image.jpg

display histogram of cropped image:
display cropped_image_histogram.gif


I also have an alternate histogram script, histog, at http://www.fmwconcepts.com/imagemagick/index.php

Re: format for piping commands in imagemagick

Posted: 2008-10-08T14:43:29-07:00
by unnati
awesome...thanks a lot u guys

Re: format for piping commands in imagemagick

Posted: 2008-10-09T10:15:04-07:00
by unnati
actually one more question...can i store the output of histogram:info into a .odt file??

Re: format for piping commands in imagemagick

Posted: 2008-10-09T16:24:43-07:00
by anthony
I assume an .odt file is open office type document. You will need some type of converter.

If it is a spreadsheet filetype, then use various text utilities to re-format the output into a cvs file that spreadsheet programs can read.

Basically it will be up to open office to provide you with a batch converter for that type of thing. It is well beyond the scope of ImageMagick.