如何将exif数据添加到图像?

问题描述:

在我们的网站上,我们收到了大量从各种来源上传的照片。

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

为了保持文件大小不变,我们删除所有 mogrify 的来源的exif数据:

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

mogrify -strip image.jpg

我们希望能够做的是将一些基本的exif数据(版权所有Initrode等)插回到这个新的干净图像中,但我似乎无法在文档中找到任何内容实现这一目标。

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?

如果无法通过imagemagick完成,那么基于PHP的解决方案将是下一个最好的解决方案!

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

谢谢。

您可以节省大量空间,特别是如果您有大量图像..

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

将以下内容添加到text.txt(从这里):

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来自图像的所有现有exif数据

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