Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add exif data to an image?

Tags:

On our site, we get a large amount of photos uploaded from various sources.

In order to keep the file sizes down, we strip all exif data from the source using mogrify:

mogrify -strip image.jpg 

What we'd like to be able to do is to insert some basic exif data (Copyright Initrode, etc) back onto this new "clean" image, but I can't seem to find anything in the docs that would achieve this.

Has anybody any experience of doing this?

If it can't be done through imagemagick, a PHP-based solution would be the next best thing!

Thanks.

like image 684
ConroyP Avatar asked Oct 23 '08 11:10

ConroyP


People also ask

Can you add EXIF data?

EXIF is Device Data Because Exif data is added automatically by your camera or capture device, you can't really input Exif data except to insure that your camera is set to record the correct date and time.

Can I add metadata to a JPEG?

You can use Photoshop, if you have it, to add metadata to a photo by just clicking File > File Info, filling in the boxes, and saving the file. But you still have to add the metadata to one photo at a time this way, and if you are adding metadata to a JPEG, saving it will compress your photo slightly.

How do you enter EXIF data?

On a Windows PC using File Explorer right-click on the file you want to see the data for. You will see a window pop up with various options. Click on Properties and then on Details. This will bring up the EXIF data for that photo.


2 Answers

You can save a large amount of space, especially if you have a large number of images..

Add the following to text.txt (format of the IPTC tags taken from here):

2#110#Credit="My Company" 2#05#Object Name="THE_OBJECT_NAME" 2#55#Date Created="2011-02-03 12:45" 2#80#By-line="BY-LINE?" 2#110#Credit="The CREDIT" 2#115#Source="SOURCE" 2#116#Copyright Notice="THE COPYRIGHT" 2#118#Contact="THE CONTACT" 2#120#Caption="AKA Title" 

Strip all existing exif data from the image

mogrify -strip image.jpg 

Add the credit to your image

mogrify -profile 8BIMTEXT:text.txt image.jpg 
like image 137
Ciaran Avatar answered Dec 10 '22 11:12

Ciaran


Exiftool looks like it would be an exact match for you.

I haven't tried it but I'm now tempted to go and fix all my honeymoon photos which are marked 01/01/2074 because I forgot to reset the date after the batteries died.

like image 44
Colin Pickard Avatar answered Dec 10 '22 12:12

Colin Pickard