Identify - Orientation - images size mm

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
Albireo
Posts: 68
Joined: 2010-01-12T03:32:23-07:00
Authentication code: 8675309

Identify - Orientation - images size mm

Post by Albireo »

Hello!

I want to resize all the new images. (possibly change the orientation)
(I understand that it can be done in many ways, but what is the best way?)
but don't resize the images that already have the right size.

Is the only way to do this by creating a file with
"identify-verbose" command like this:

Code: Select all

Identify -verbose pic1.jpg > res_pic1.txt
then search in the text file after desired information

When the images are large (they are from the beginning), it takes a while.....

(I should now look how to reduce the size of an image without losing information - but I think I find it in any way) :)

//Jan
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Identify - Orientation - images size mm

Post by Bonzo »

How are you using your code - batch file, bash file, php, etc.

There are some resize options see: http://www.imagemagick.org/script/comma ... p#geometry but IM reads the image in first to see if the conditions are met then saves it again. This is OK for lossless images but jpg will be compressed.
Last edited by Bonzo on 2010-01-15T12:21:04-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Identify - Orientation - images size mm

Post by fmw42 »

what defines the right size?

To resize only if larger than some size, then

convert image -resize "WidthxHeight>" result

see > symbol at

http://www.imagemagick.org/script/comma ... p#geometry
Albireo
Posts: 68
Joined: 2010-01-12T03:32:23-07:00
Authentication code: 8675309

Re: Identify - Orientation - images size mm

Post by Albireo »

Thank you for the answer.
Bonzo wrote:How are you using your code - batch file, bash file, php, etc..
I want to manage all the images automatically by doing a "batch file" with AutoHotkey.
(maybe 500-1000 pcs)
Bonzo wrote:...........IM reads the image in first to see if the conditions are met then saves it again.....
Most of the images will be stored in jpg format :(
Is it only "-resize", which reads the image and save it again?
fmw42 wrote:what defines the right size?
The pictures will be published on the internet.
On the site you can see a small image, when you click on it, opens a larger image
(Right now I don't know what "right-size" is.)
fmw42 wrote:To resize only if larger than some size.........
Most images are designed to be printed on large format printers (high resolution)
(Would not be great if these pictures are published directly on the web :-))

and hard to keep track of all the pictures manually

My question remains:
Is it easy to get the size of the picture? (or another parameter)

(I can easy read the picture size in kb on the hard disk but I can't read other parameters....)

//Jan
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Identify - Orientation - images size mm

Post by fmw42 »

My question remains:
Is it easy to get the size of the picture? (or another parameter)
Easy to get width, height or filesize (or many other parameters)

see http://www.imagemagick.org/script/escape.php

convert image -format "width=%w height=%h filesize=%b" info:

If you want to put them into variables, then one at a time:

width=`convert image -ping -format "%w" info:`

The above is unix. I am not sure how you would do that in Windows as windows does not like the back quotes.

see
http://www.imagemagick.org/Usage/windows/

and see el_supremo's comments at viewtopic.php?f=1&t=15352
Post Reply