TechnikTobi / little_exif

A little library for reading and writing EXIF data in pure Rust.
Apache License 2.0
22 stars 5 forks source link

Unexpected exclamation marks #34

Closed TechnikTobi closed 3 weeks ago

TechnikTobi commented 3 weeks ago

One weird thing: some pictures (supposedly all from the same original source/Camera) show a Comment (AKA "Annotation") as three exclamation marksin ThumbsPlus. Explorer Details shows the correct 'Image Descriptionastitle`(and no exclamation marks whatsoever.

In the file there indeed is a "!!!" string somewhere. The original file does not contain such a string.

I did check my software but did not find any hint of three exclamation marks.

_Originally posted by @mschnell1 in https://github.com/TechnikTobi/little_exif/issues/32#issuecomment-2438276239_

Required:

mschnell1 commented 3 weeks ago

www.bitvibe.de/Upload/A0040453.JPG setting ImageDescription to "IW Collection, Fotoshooting, Rheinberg, Juni 2008" which actually does not work. According to Explorer Details Titel = "!!!". According to ThumbsPlus the "Comment" is "!!!"

TechnikTobi commented 3 weeks ago

Can you tell me what you get now for Titel and comment with this modified file?

mschnell1 commented 3 weeks ago

I get "l_e"

As well with ThumbsPlus Comments (which also sees Camera data etc) as with Explorer Details Titel ?!?!?!?

TechnikTobi commented 3 weeks ago

That is what I was hoping for ;-) This means that the "!!!" string comes from the Photoshop Segment (see issue #35) that already exists in your source JPG image file (note: this segment is specific to JPG only). I used a hex editor to locate the exclamation marks and changed them so something I came up with ("l_e" as abbreviation for "little_exif").

This means however that adding the ImageDescription via little_exif won't work. As I am not an expert in the Photoshop Segment data structure and edit the description there as well we could think about simply removing the segment (as it does not hold any data that obviously seems important:

Bildschirmfoto 2024-10-26 um 13 08 59

The highlighted area is this Photoshop Segment (as noted by the 0xFFED that are located right before the area). The next two bytes tell us that this segment has a length of 0x002C bytes, then comes some Photoshop Version information (I guess?) with the String that shows up as Comment/Titel at the end (here "l_e", the original file shows the three exclamation marks).

My proposal: Removing this segment does not show any immediate drawbacks for now, and I could add a routine that does exactly that for JPG files.

mschnell1 commented 3 weeks ago

Hmm. How can I force that the ImageDescription Exif takes priority over the PhotoShop stuff ?

My proposal: Removing this segment does not show any immediate drawbacks for now, and I could add a routine that does exactly that for JPG files.

Yep an option in Little-Exif to kill the Photoshop section would be great.

Thanks a lot !

TechnikTobi commented 3 weeks ago

Functions for clearing the APP12 and APP13 segment (both are related to Photoshop, see here) are now available in 0.6.0-beta4 and can be used via:

Metadata::clear_app13_segment(&mut file_content, file_extension);

which returns an error if this is called e.g. on a PNG file that error can be ignored.

mschnell1 commented 3 weeks ago

I added this line after reading the file content. # Unfortunately nor ThumbsPlus does not accept many files to be pictures any more.

TechnikTobi commented 3 weeks ago

Was this already the case with my two example images?

mschnell1 commented 3 weeks ago

No. Your test images shows just fine, only with weird the "comments" we discussed.

Here the original of an example with the new issue:

www.bitvibe.de/Upload/dsc61076.jpg

TechnikTobi commented 3 weeks ago

And what if you only perform the APP13 segment removal without modifying the metadata (i.e. disabling metadata.write_to_vec...)?

mschnell1 commented 3 weeks ago

Same: no picture recognized.

TechnikTobi commented 3 weeks ago

I see, I am able to reproduce this at least.

mschnell1 commented 3 weeks ago

A0040453.JPG does work OK.

TechnikTobi commented 3 weeks ago

Found, fixed and released in beta5

mschnell1 commented 3 weeks ago

I don't see any problem with Beta.5 here ! Thanks a lot for making this happen !!!