Good evening everyone,
What is the most reliable tag to get the width of a jpg image?
I found out that some of my jpgs return a width using "EXIF:ExifImageWidth" and some using "EXIF:ImageWidth".
If i use the composite tag "ImageWidth" do i get independent of this?
When i use the tag "ImageWidth" (running from python), then exiftool returns the value using the key "File:ImageWidth".
Is this always the case?
Thanks a lot for your help.
This is a good point. PDF Keywords aren't currently handled properly when adding to an existing list. Your 2-step method is the work-around, but I will look into this and see how difficult it would be to improve the situation in a future release.
- Phil
For a jpeg, you would use ImageWidth and ImageHeight. The EXIF image tags are filled out whatever program is writing the file and can be inaccurate if a program edits the file without editing those tags.
Personally, for this reason, I find them absolutely useless as very few programs will actually write the tags, even though EXIF:ExifImageWidth and EXIF:ExifImageHeight are considered mandatory according to the spec. They are among the list of tags that I automatically remove in my workflow, though if you want to keep them and make sure they're accurate, you could run this command
exiftool "-EXIF:ExifImageWidth<ImageWidth" "-EXIF:ImageWidth<ImageWidth" "-EXIF:ExifImageHeight<ImageHeight" "-EXIF:ImageHeight<ImageHeight" /path/to/files/
Quote from: Phil Harvey on February 14, 2022, 09:46:59 AM
This is a good point. PDF Keywords aren't currently handled properly when adding to an existing list. Your 2-step method is the work-around, but I will look into this and see how difficult it would be to improve the situation in a future release.
- Phil
Responding to the wrong post? Maybe this one (https://exiftool.org/forum/index.php?topic=13305.0)?
Quote from: StarGeek on February 14, 2022, 09:53:24 AM
For a jpeg, you would use ImageWidth and ImageHeight. The EXIF image tags are filled out whatever program is writing the file and can be inaccurate if a program edits the file without editing those tags.
I am happy with using only ImageWidth and ImageHeight (abandoning EXIF:ExifImageWidth and EXIF:ImageWidth).
Then my question is:
If i use
ImageWidth and
ImageHeight does exiftool return as
File:ImageWidth and
File.ImageHeight?
For a jpeg/tiff/png, I believe so, though you could always specify File:ImageWidth/Height to be sure.
For a RAW file type such as NEF/CR2, I'm not sure. I could have sworn that for RAW files it would return the File group dimensions because I was having some problems with CR2 dimensions some time ago, but my quick test doesn't give File results on those file types.
Quote from: StarGeek on February 14, 2022, 09:54:01 AM
Responding to the wrong post? Maybe this one (https://exiftool.org/forum/index.php?topic=13305.0)?
Ooops. Thanks.
- Phil
QuoteFor a jpeg/tiff/png, I believe so, though you could always specify File:ImageWidth/Height to be sure.
Thanks for your help, this works for me.
The group for the best ImageWidth/Height may change, but it should (hopefully) always be the priority tag, so you shouldn't have to worry about the group. It will be the one you get if you don't specify a group. The only exception I know is for HEIC files -- I need to fix things to properly prioritize the size tags for this type of file.
- Phil
Quote from: StarGeek on February 14, 2022, 09:53:24 AMFor a jpeg, you would use ImageWidth and ImageHeight. The EXIF image tags are filled out whatever program is writing the file and can be inaccurate if a program edits the file without editing those tags.
I have noticed this too.
Is the
Composite:ImageSize tag accurate? I noticed on this page (https://exiftool.org/TagNames/Composite.html), it says the
ImageSize composite tag is derived from
ImageWidth,
ImageHeight,
ExifImageWidth,
ExifImageHeight, and
RawImageCroppedSize.
What format of images are you asking about?
- Phil
I deal mostly with JPG and MOV. But your question suggests there is a different answer depending on the format?
For JPG images and MOV videos, Composite:ImageSize should be accurate.
For some RAW formats the ImageSize may not be what you expect.
Other formats I would have to answer on a case-by-case basis.
- Phil
What about for CR2, DNG, and HEIC photos, and AVI and MP4 videos?
You'll have to check the files. Use this command to see all the width/height/size type tags in the file. If you're on Mac/Linux, put quotes around the parts with the asterisk
exiftool -G -a -s -*size* -*width* -*height* /path/to/files/