Why orientation tag change causes kilobyte level changes in image files?

Started by polarbeer, October 01, 2011, 05:45:52 AM

Previous topic - Next topic

polarbeer

Hi,

First of all I'm not a software programmer, so my questions might seem dumb - sorry for that.  8)

Lately I have been trying to figure out what software to use to make metadata changes and additions into my digital camera photos.

I just downloaded latest versions of ExifTool (8.65) and ExifToolGUI (4.21.0.0). With ExifToolGUI I tried to change just the orientation tag of a picture that has been taken in portrait position, but the picture's orientation tag(s) has/have value "Horizontal (normal)".

(The test picture was taken with Panasonic GH2 -camera using 20 mm F1.7 lens. The lens lacks image stabilisation (IS) system so camera can't record the right orientation tag into photos when using this lens.)

So I chose this test picture in ExifToolGUI and chose [^] button under [EXIF] button --> Image Properties tab --> Chose Tag value: Rotate right --> Pressed [SAVE] button (backup option checked and nothing else changed in ExifToolGUI).

I made this orientation tag editing for TEST.JPG and TEST.RW2 (raw) images. After ExifToolGUI editing both JPG and RW2 files' file size has decreased several kilobytes:

TEST. JPG_original: 3004 KB    vs.      TEST.JPG: 2989 KB
TEST.RW2_original: 18 289 KB     vs.    TEST.RW2: 18 273 KB

I also compared original vs. edited photos in free Frhed hex editor and free WinMerge application (which is said NOT to be hex editor). Because I don't exactly understand how these two applications actually work my findings might be totally wrong. However they both report difference level that feels to suit difference in file sizes.

I'm curious to know what is explanation into these results I'm getting. Shouldn't orientation tag(s) editing be possible with just changing some byte value into other value in file? Thus file size should remain the same after editing tag values?

-pb

PS. Software called Picture Information Extractor 6.0 Free (=PIE) shows ExifToolGUI edited test test photos in portrait position ie. tag editing in ExifToolGUI seems to work. However it founds some orientation tags that are unaltered after ExifToolGUI editing. So metadata editing of original photos seems to be a really messy topic and I'm very skeptical if I can trust any tool currently on market.

Using sidecar files (XMP?) seems to be a more safe way to link metadata into your photos as original photos are left unaltered.






Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

polarbeer

Quote from: Phil Harvey on October 01, 2011, 06:28:09 AM
This is FAQ number 13.

- Phil

Thanks for quick answer!

Sorry to bother but are ExifTool or ExifToolGUI recommended to be used to edit RAW files? Or is it best to let RAW files of different camera manufacturers "rest in peace"?


Phil Harvey

ExifTool has been used by many people to write RAW files from various cameras over the course of a number of years with no problems, but I always recommend keeping backups of your originals.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

BogdanH

Hi,
And my opinion: matadata belongs inside image file. Period.
I am writting my data inside raw photo files (Canon, that is) since 2005 and I never, ever experienced any problems.
Right now, I'm working on short article, which should explain some stuff related to this topic.

Bogdan

polarbeer

Thanks for your help and input,

Well I don't like extra files either. It's just nice and simple to put metadata inside the files. (However sidecar files would make backup processes faster as you would have to often backup only small backup files. This might be a good reason for some users.)

Am I right, that editing/putting metadata inside files isn't so dangerous as some sources suggest, because different areas inside *.jpg AND raw files (thumbnail image data, EXIF data, IPTC data, XMP data, RAW/JPG main image data) are so well marked in jpg and different raw image formats, that corrupting your files totally isn't really a threat any more?

So metadata editing "problems" are mostly situations where some single tag has been edited in a way that some program(s) might not be able to read it correctly? So corrupting your RAW files in a way, that none of the common viewers/editors could read main image data and most of the EXIF data, isn't "possible".

So as long as you make some tests to open your files with a couple of common image viewers after editing metadata, should reveal "catastrophic" programming errors?

-pb


Phil Harvey

I wasn't entirely accurate when I said "no problems".  See the Known Problems section of the ExifTool home page for a couple of examples of problems other software has had in the past when reading edited RAW images.

The main difficulty with RAW images is that the format is undocumented.  Although RAW formats are based on TIFF, they contain additional IFD's which must be parsed properly in order to rewrite the images without loss of information.  The "known problems" mentioned above were a result of other software that was not parsing these IFD's properly when reading.  In general, this shouldn't happen with the manufacturer's software since they should understand how to properly read the images, but it has occurred in the past with some 3rd party software vendors.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

BogdanH

Quote from: polarbeer on October 02, 2011, 11:43:27 AM
Am I right, that editing/putting metadata inside files isn't so dangerous as some sources suggest, because different areas inside *.jpg AND raw files (thumbnail image data, EXIF data, IPTC data, XMP data, RAW/JPG main image data) are so well marked in jpg and different raw image formats, that corrupting your files totally isn't really a threat any more?
-that's exactly what I believe (and as long I'm using Exiftool).

QuoteSo as long as you make some tests to open your files with a couple of common image viewers after editing metadata, should reveal "catastrophic" programming errors?
-which is what I do.
Because I use Canon camera, when a new version of Canon raw converter is out, I first check some of my old files, if they are still readable by "official" software. As long that's true, I don't care about other software: it's up to them to adapt. However, I can only speak for Canon/Exiftool combination. And I'm aware, that there's no guarantee.

Bogdan