Page 1 of 1

DETECT IMAGE SIZE

Posted: 2012-09-15T02:27:50-07:00
by foruforewer
I want to detect input image size can anyone guide?

Re: DETECT IMAGE SIZE

Posted: 2012-09-15T10:22:14-07:00
by fmw42
convert image -format "%wx%h" info:
or
identify -format "%wx%h" image

gives the width x height


convert image -format "%b" info:
or
identify -format "%b" image

gives the filesize


see string formats at http://www.imagemagick.org/script/escape.php

Re: DETECT IMAGE SIZE

Posted: 2012-09-17T02:14:01-07:00
by foruforewer
thank you very much

Re: DETECT IMAGE SIZE

Posted: 2012-09-17T02:33:36-07:00
by foruforewer
Next que.. after getting height and width, i want to store them in some variable and add 100, so i had tried further as below but not working. can you please guide in this?

Code: Select all

set ht=identify -format "%h" im1.png
set wd=identify -format "%w" im1.png
set /A ht=ht+100
set /A wd=wd+100
set "sz=%ht%x%wd%"
convert -size sz xc:black output.png
but it wont working at
1) storing in ht,wd
2) defining concatenated string by sz

Re: DETECT IMAGE SIZE

Posted: 2012-09-18T10:05:51-07:00
by fmw42
on unix

newht=$((ht+100))

or you can compute it from scratch

newht=`convert image -format "%[fx:h+100]" info:`
or
newht=$(convert image -format "%[fx:h+100]" info:)

Re: DETECT IMAGE SIZE

Posted: 2012-09-18T18:38:39-07:00
by anthony
IMv7 "magick" command will allow you to do all this in the one command line (or file script).