我有一个调整大小的函数,它可以正确地完成它的主要工作,但不保存原始图像文件附带的exif数据。一切似乎都是正确的,直到我调用->writeImage();函数,它似乎剥离了图像的exif数据。
$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数据保存在图像上?
发布于 2014-04-20 17:18:16
似乎错误不在那里,for the first time。
我目前使用的一种解决方法:
exiftool -overwrite_original_in_place -tagsFromFile $source_file $converted_file发布于 2014-04-20 18:38:51
如果要保留thumbnailImage数据,则不应使用exif图像方法。以下内容摘自ImageMagick (http://www.imagemagick.org/script/command-line-options.php#thumbnail)的文档:
-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)
https://stackoverflow.com/questions/22534752
复制相似问题