-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Which Image structure does Image.setComment() set? #1445
Comments
Happy New Year. Image.setComment() sets the COM block in a JPEG. (base) rmillsmm-local:~ rmills$ cp ~/Stonehenge.jpg S.jpg ; exiv2 --comment "Happy New Year" ~/S.jpg ; exiv2 -pS ~/S.jpg
STRUCTURE OF JPEG FILE: /Users/rmills/S.jpg
address | marker | length | data
0 | 0xffd8 SOI
2 | 0xffe1 APP1 | 15272 | Exif..II*......................
15276 | 0xffe1 APP1 | 2786 | http://ns.adobe.com/xap/1.0/.<?x
18064 | 0xffed APP13 | 96 | Photoshop 3.0.8BIM.......'.....
18162 | 0xffe2 APP2 | 4094 | MPF.II*...............0100.....
22258 | 0xffdb DQT | 132
22392 | 0xfffe COM | 17 | Happy New Year
22411 | 0xffc0 SOF0 | 17
22430 | 0xffc4 DHT | 418
22850 | 0xffda SOS
(base) rmillsmm-local:~ rmills$ For a PNG file, the comment is an iTXt chunk with Title==Description
This is documented in the book AND the exiv2 man page. I think it's rather regrettable that Exiv2 offers this feature as it cannot be applied to every image format. It's not Exif, IPTC, or XMP metadata. I suspect it was added early in the life of Exiv2 and has remained ever since. |
Thank you for your help. |
Thanks for closing this, @LeoHsiao1 Exif.Photo.UserComment is different from JPEG/COM. The key Exif.Photo.UserComment means: Exif = It's defined in the Exif metadata
There are different Groups in the Exif Metadata such as Image (defined in TIFF/EP spec), Photo (defined in Exif 2.X spec), GPSInfo (also defined in Exif 2.X spec) and Nikon, or Canon etc (decoded from the MakerNote). Here's a drawing from the book that I hope clarifies the design of the file that comes out of the camera. Exiv2 (and tvisitor.cpp) provide the code to successfully navigate the file. |
@LeoHsiao1 Other thoughts about this. The drawing above illustrates how the data is stored in a TIFF (the .NEF Nikon Raw File is a TIFF). All the different formats (JPEG, PNG, ISOBMFF etc) have slightly different schemes to store Exif, IPTC, XMP and ICC data. And some file formats can store data that is not part of Exif, IPTC, XMP and ICC. JPEG/COM is a good example. It's a relic from the early 1990s and unique to JPEG. I can't explain how/why all those different formats came about. For sure they are a software challenge to say the least. Adobe have tried to provide leadership with both the XMP and DNG standards. The manufacturers seem to prefer chaos. Canon have had 3 totally different "Raw" formats in less that 20 years. I know of no manufacturer who has documented their MakerNote. You asked me once if there will be new metadata standards in the future. I hope not. I wish the manufacturers would agree and stick to a few standards. |
Thank you for your detailed explanation. |
I have tried to put everything I know about both Metadata and Exiv2 into the book. I hope Exiv2 will survive. Exiv2 is 100% documented and 100% free of defects. It's in good shape with one exception which is that nobody seems willing to work on Exiv2 maintenance. The Community does not have a viable C++ replacement for Exiv2. |
Happy New Year!
Exiv2 provides this method:
exiv2/include/exiv2/image.hpp
Line 159 in 0dd82dd
But which Image structure does
Image.setComment()
set?According to this document, JPEG images contain the Comment segment:
Images in other formats don't have the Comment segment. So are they not suitable for
Image.setComment()
?I tried to modify an PNG image with
Image.setComment()
, but the Comment text was saved in a block callediTXt
.By the way, there's no introduction that Exiv2 can modify image comments, on the homepage of Exiv2, or in @clanmills 's book.
I used to think that Exiv2 could not modify the image comments.
The text was updated successfully, but these errors were encountered: