Add comment on image file header

Started by Nikunj Agola, April 21, 2017, 07:10:07 AM

Previous topic - Next topic

Nikunj Agola

I am working on an iOS application and in this application, I want to add a comment(s) in image file header. As I able to add a comment on EXIF metadata under UserComment but I want to add multiple comments in the image file header under "Comment" key.

Which framework do I use? For UserComment, I am using the ImageIO framework. Please read this link s000.tinyupload.com/?file_id=00209075531742860207

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 ($).

Nikunj Agola

Thank you, Phil, for your quick reply,

But we want to write and read "JPEG Comment (COM segment)" in an iOS mobile application. I have also searched XMP and Is it any comment section or tag to extract "JPEG Comment (COM segment)"?

Thanks in advance  :)

Phil Harvey

Oh, I see.  You want to do this on iOS and you can't run ExifTool there.  I'm running ExifTool on my iOS device, and it was easy for me to do, but it would probably be a lot harder if the device isn't jailbroken.  But if you just want to read the COM segment it should be very simple to just open the JPEG and parse it yourself using standard file i/o.

- 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 ($).

Nikunj Agola

Hello Phil,

Thank you so much for your answer as you said I am able to fetch COM segment and also add/edit comments but I have one query. If an image has not a single COM segment then in which index I have to add COM segment? Another point is when I am trying to modify COM segment of Captured image from iPhone device there are error message popped up that "Unable to save changes -  An error occur while saving"

I have attached a link to JPEG file format http://s000.tinyupload.com/?file_id=42277708729639142098

Phil Harvey

ExifTool combines multiple COM segments into a single Comment when extracting, and will create multiple COM segments when writing if the comment exceeds 64 kB in length.

I don't know about that error message -- it isn't from ExifTool.

- 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 ($).

Nikunj Agola

Ok, But in which index you add COM segments in ExifTool?

No error message isn't from EXifTools but it comes when I am trying to add COM segment of captured image from iOS Camera.

Phil Harvey

Quote from: Nikunj Agola on May 09, 2017, 08:11:41 AM
Ok, But in which index you add COM segments?

Sorry, but I don't understand the question.

- 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 ($).