pil 获取图像尺寸
The command line is a gold mine if you come from the perspective of a UI lover. Getting information from the shell instead of opening an app, finding a file or directory, etc...what a novel concept. Opening different image files opens up different apps on my Mac and, as the kids say, "ffs" -- I just want to know the image dimensions.
如果您从UI爱好者的角度来看,那么命令行就是金矿。 从外壳程序获取信息而不是打开应用程序,查找文件或目录等……这是一个新颖的概念。 打开不同的图像文件会在Mac上打开不同的应用程序,就像孩子们说的那样,“ ffs”-我只想知道图像的尺寸。
Using ImageMagick you can find the dimensions of an image from command line:
使用ImageMagick,您可以从命令行找到图像的尺寸:
# Get the size of a JPG
convert photo.jpg -print "Size: %wx%h\n" /dev/null
# Size: 600x872
# Get the size of a PSD
convert website-design.psd -print "Size: %wx%h\n" /dev/null
# Size: 990x1200
You can get the image dimensions of any image type from PNG to JPG to GIF to even PSDs. And the resulting text is as plain as it could be. Dimensions...here you are.
您可以获取任何图像类型的图像尺寸,从PNG到JPG到GIF甚至是PSD。 结果文本尽可能的简单。 尺寸...就在这里。
pil 获取图像尺寸