get width and height of an image file
i am looking for a tool to get the width and height of an image file that is formatted in any of the major image formats like: bmp, gif, jpg, png, and more, even if the extension of the file name is wrong (for example a png file named as a gif file). it will need to figure out the format based on file contents.
it's output needs to be basically simple enough for a small shell script to parse it. output that is just the 2 numbers would be good. |
ImageMagick's "identify" command does exactly that.
If you need a library, gdk-pixbuf loads many image formats. Ed |
we have very good search engines to find answers to questions like this.
for example: https://unix.stackexchange.com/quest...ze-of-an-image |
|
There is also exiftool.
Typically the utilities use the file's magic number to determine image type and not the filename. |
If you bothered to search, you should state what search terms you used, and what's wrong with the results you received.
This does several things: 1) it would demonstrate that you're not just being lazy. 2) it helps the next person using those same search terms to find an answer. 3) it allows responders to provide useful advice instead of repeating what you've already dismissed. |
You use “identify” from ImageMagick.
|
Plain old file will do that.
|
Quote:
|
Quote:
|
Quote:
|
Quote:
Better yet, search for what you're trying to do with that information, and there's a fair chance someone has already done it and may have released the results. |
Quote:
|
Quote:
|
Quote:
Bash Scripting - Bash Echo Command - GeeksforGeeks Quote:
|
All times are GMT -5. The time now is 11:05 PM. |