format for piping commands in imagemagick

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
unnati

format for piping commands in imagemagick

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: format for piping commands in imagemagick

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
unnati

Re: format for piping commands in imagemagick

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: format for piping commands in imagemagick

Post 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
unnati

Re: format for piping commands in imagemagick

Post by unnati »

awesome...thanks a lot u guys
unnati

Re: format for piping commands in imagemagick

Post by unnati »

actually one more question...can i store the output of histogram:info into a .odt file??
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: format for piping commands in imagemagick

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply