ImageMagick能否返回图片大小? [英] Can ImageMagick return the image size?

查看:193
本文介绍了ImageMagick能否返回图片大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从命令行使用ImageMagick调整图片大小:

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

convert -size 320x240 image.jpg

但是,我不知道如何确定最终图像的大小。由于这是一个成比例的图像缩放,新图片很有可能是100x240或320x90(不是320x240)。

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).

我可以调用'convert'图像并返回新的图像尺寸?例如,伪代码:

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


推荐答案

您可以使用额外的

convert -size 320x240 image.jpg; identify -format "%[fx:w]x%[fx:h]" image.jpg

这篇关于ImageMagick能否返回图片大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆