Support for EXIF

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
eastern_strider

Support for EXIF

Post by eastern_strider »

Does Magick++ allow to read/write exif headers (and query individual exif tags such as exposure time) for JPEG and TIF files?

Thanks,
eastern_strider
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Support for EXIF

Post by magick »

Get EXIF tags with image.attribute("exif:tag") where tag is the EXIF tag you are interested in..
mtrierscheid

Re: Support for EXIF

Post by mtrierscheid »

Hello,
I'm currently trying to write exif-information into png and tiff images using Magick++.
I managed to write attributes into a tiff image and to read them out, using "display". I can write into the fields "Model", "Copyright" and "Artist". Can I also use custom fields? If yes, can I read them out without using the ImageMagick GUI or other tools?
And how can I write exif tags to and read them from png-images?
I'm new to Exif and ImageMagick.

Thanks!
Marina
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Support for EXIF

Post by magick »

ImageMagick treats EXIF as a blob. It does parse the properties but there is no mechanism to update any field other than resolution. You will need to parse/update the blob yourself or use some other program to update the EXIF properties.
mtrierscheid

Re: Support for EXIF

Post by mtrierscheid »

Thanks for the quick answer!
Could you please describe that a little bit more in detail? What would I have to do if I wanted to create a new field like "IntegrationTime"?
I added this field by

Code: Select all

image.attribute("IntegrationTime", "10000");
Or should it be

Code: Select all

image.attribute("exif:IntegrationTime", "10000");
?
Before writing the image to a file I can read this attribute out again by calling

Code: Select all

std::cout<<image.attribute("IntegrationTime"); 
That's fine. But when I read the image from this file the attribute has "gone", the attribute-method returns an empty string.

So, what can I do?
Thanks in advance!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Support for EXIF

Post by magick »

ImageMagick does not update the EXIF blob other than the image resolution and the image orientation fields. You are responsible for parsing an EXIF blob and updating any fields you require. There are plenty of EXIF utilities that you can use to accomplish this. If you want to use Magick++ you would need to extract the EXIF profile as a blob, update it, and inject it back with the exifProfile() method.
Post Reply