Forum > Packages and Libraries

fpexif issues while modifying date and time

(1/3) > >>

rpetges:
Hi all,

I use WP's fpexif library in my application to modify EXIF date and time in JPEG images. However, recently a customer sent me JPEG file and the library was unable to update the date and time.

I use the following code to update EXIF's date and time. It works fine, except for a JPEG taken with a Fuji Finepix S3500


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  L_ImageInfo := TImgInfo.Create;   try    L_ImageInfo.LoadFromFile(F_FullName);    if L_ImageInfo.ExifData <> nil then    begin       L_Tag := L_ImageInfo.ExifData.TagByName['DateTimeOriginal'];      if L_Tag <> nil then        TDateTimeTag(L_Tag).AsDateTime := F_NewPhotoDT;       L_Tag := L_ImageInfo.ExifData.TagByName['DateTimeDigitized'];      if L_Tag <> nil then        TDateTimeTag(L_Tag).AsDateTime := F_NewPhotoDT;       L_Tag := L_ImageInfo.ExifData.TagByName['DateTime'];      if L_Tag <> nil then        TDateTimeTag(L_Tag).AsDateTime := F_NewPhotoDT;       try        L_ImageInfo.SaveToFile(F_FullName);       except         .... // Update failed and this is the case for the Fuji Finepix S3500 camera      end;  
When I change the JPEG date and time with Windows Explorer for example, then it gets's changed correctly. Using fpExif afterwards with the above code then works fine, so I assume that the initial EXIF header causes troubles to MODIFY date and time information. The library however can correctly READ the information.
Romain

wp:
I don't fully understand what the problem is. Let me put in my words: You want to update the date/time information stored in the EXIF metadata of a jpg taken with a Fuji Finepix S3500 using the code posted. But your customer reports that the date/time is not updated. What is he doing that he is able to tell that something is wrong? Which program is using to read the EXIF back from the jpeg? Is the date/time not written at all, or is it written falsely?

Is the EXIF still readable after doing the modification?

rpetges:
I sent you a link to download the customer's photo.

If you have a look at the image properties in Windows Explorer, you can see that the photo has been taken in 2004. I verified with Phil Harvery's ExifTool and the EXIF header seems to be correct.

Now, the customer tries to update the EXIF date and time values with my application ( Attribute Changer ). The code used to update the values is the one I posted above. However, the data and time values in the EXIF header do net get updated. In fact, the SaveToFile method in fpExif generates an exception.

So, data is not written at all.

During my troubleshooting, I found the following ( maybe it's helpful to you to troubleshoot the issue )

- Take the customer image and change the Date Taken in Windows Explorer to a different date and time.
- Use Attribute Changer to update EXIF date and time > now works !
- Verify with Windows Explorer or Exif Tool > data and time successfully changed.

This means that the original FinePix generated photo information can not be changed, but once modified with Windows Explorer, it can be changed with the above code.

Hope, this helps.

wp:
Thanks for the explanation.

Can you try to analyze the image modified in Windows Explorer by means of Phil Harvey's ExifTool? (Or send me a link to this image so that I can have a look by myself). Try to find out whether the EXIF segment still contains the MakerNotes tag because I guess that Windows stripped it.

The MakerNotes are a part of the EXIF structure in which manufactures can write whatever they want, and of course this is not documented at all, there's just some inofficial documentation on several sites bases on reverse-engineering. The fatal thing is that most manufacturers use the same TIF-based file format for their data as for the other EXIF data. This means that the MakerNotes chunks can only be understood on the basis of offset values relative to the beginning of the TIF header. fpexif reads the binary undecoded MakerNotes (there are a few attempts to decode them) and writes them back unchanged. Editing some other part of the EXIF structure, however, alters the offsets to the data chunks. This does not matter for the well-documented tags for which the offsets can be corrected, but it is fatal for the maker notes where the offsets now point to wrong data.

rpetges:
I sent you a PM with the download link.

The only modifications I did with Windows Explorer is to change the 'Date Taken' date part property to 08/08/2008

In ExifTool, the additional EXIF properties seem still to be present. Some values were modified/deleted by Windows Explorer, but for me it does not seem to be critical. However, for your library it seems to make a big difference as the 'SaveToFile' method works after this manipulation.

Hope this helps,
Romain

Navigation

[0] Message Index

[#] Next page

Go to full version