Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can ImageMagick return the image size?

I'm using ImageMagick from the command line to resize images:

convert -size 320x240 image.jpg 

However, I don't know how to determine the size of the final image. Since this is a proportional image scale, it's very possible that new image is 100x240 or 320x90 in size (not 320x240).

Can I call the 'convert' command to resize the image and return the new image dimensions? For example, pseudo code:

convert -size 320x240 -return_new_image_dimension image.jpg   // returns the new resized image dimensions 
like image 829
JacobT Avatar asked Oct 12 '09 16:10

JacobT


People also ask

Which ImageMagick program will show you an image file?

Image Viewer Use the display program to display an image or image sequence on any X server.

What can you do with ImageMagick?

ImageMagick can resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.

What is ImageMagick legacy?

Use ImageMagick® to create, edit, compose, or convert digital images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, GIF, WebP, HEIC, SVG, PDF, DPX, EXR and TIFF.

Does ImageMagick have GUI?

Left-clicking on an image brings up a simple, standalone menu (the only GUI feature you'll see in ImageMagick).


1 Answers

You could use an extra call to identify:

convert -size 320x240 image.jpg; identify -format "%[fx:w]x%[fx:h]" image.jpg
like image 96
Arjan Avatar answered Oct 04 '22 19:10

Arjan