首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ImageMagick保留Exif数据

ImageMagick保留Exif数据
EN

Stack Overflow用户
提问于 2014-03-20 21:39:35
回答 2查看 6.1K关注 0票数 4

我有一个调整大小的函数,它可以正确地完成它的主要工作,但不保存原始图像文件附带的exif数据。一切似乎都是正确的,直到我调用->writeImage();函数,它似乎剥离了图像的exif数据。

代码语言:javascript
复制
$resizeimage= new Imagick($image);

$exifDataArray = $resizeimage->getImageProperties("exif:*");

$resizeimage->thumbnailImage($width,$height);

$resizeimage->setImageCompression(imagick::COMPRESSION_JPEG); 
$resizeimage->setImageCompressionQuality(90); 

echo $resizeimage->setImageProperty('Exif:Make', 'BLABLABLA');

$resizeimage->writeImage();


$updated= new Imagick($image);
echo $updated->getImageProperty('Exif:Make');

请注意,如果我使用print_r($exifDataArray);命令,它将显示exif数据以进行更改,我将输入' exif : make ','BLABLABLA‘,并查看新的exif数据是否已写入映像,以及是否已正确写入

但是在I resizeimage->writeImage();之后,图像文件上没有更多的exif数据。

有人能帮上忙吗?有没有办法将exif数据保存在图像上?

EN

回答 2

Stack Overflow用户

发布于 2014-04-20 17:18:16

似乎错误不在那里,for the first time

我目前使用的一种解决方法:

代码语言:javascript
复制
exiftool -overwrite_original_in_place -tagsFromFile $source_file $converted_file
票数 6
EN

Stack Overflow用户

发布于 2014-04-20 18:38:51

如果要保留thumbnailImage数据,则不应使用exif图像方法。以下内容摘自ImageMagick (http://www.imagemagick.org/script/command-line-options.php#thumbnail)的文档:

代码语言:javascript
复制
-thumbnail geometry

This is similar to -resize, except it is optimized for speed and any image
profile, other than a color profile, is removed to reduce the thumbnail size.

您应该改用方法resizeImage (http://www.php.net/manual/en/imagick.resizeimage.php)

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22534752

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档