【问题标题】:Animated GIF Image Resize with Imagick PHP使用 Imagick PHP 调整动画 GIF 图像大小
【发布时间】:2015-06-16 04:19:09
【问题描述】:

我想在不丢失动画的情况下调整动画 GIF 图像的大小。调整大小过程工作正常,但调整大小动画消失后。如果我做错了什么,请检查我的脚本

版本:ImageMagick 6.9.1-1 PECL Imagick 扩展 - 3.1.2

$images = $this->imageObj->coalesceImages();
foreach ($images as $frame) {
 $frame->thumbnailImage($this->thumbWidth, $this->thumbHeight);
 $frame->setImagePage($this->thumbWidth, $this->thumbHeight, 0, 0);
}

$this->imageObj = $images->deconstructImages();
$this->imageObj->writeImage($this->thumbImagePath);

【问题讨论】:

标签: php imagemagick


【解决方案1】:

见this answer。从链接:

如果你有 imagemagick 访问权限,你可以这样做:

system("convert big.gif -coalesce coalesce.gif");
system("convert -size 200x100 coalesce.gif -resize 200x10 small.gif");

【讨论】:

  • 您好,我在发布问题之前浏览了所有提供的链接。我只想通过 PHP ImagicK pecl 扩展来做到这一点。我也试过用 file_put_contents writeImage 但它也没有帮助。
  • @user524694,在我发布的链接中还有另一种方法。
  • 嗨,我现在可以调整动画 GIF 图像的大小,但是当我使用 Imagick 流式传输相同的图像时,它会渲染图像但动画丢失,当我使用 file_put_contents 打印相同的图像时,它会渲染图像而不会丢失动画。跨度>
  • 嗨,我可以知道使用 Imagick 和 readfile 的流式图像之间的性能、资源利用率。
  • @user524694,我不知道。
猜你喜欢
  • 2013-06-11
  • 1970-01-01
  • 2021-07-20
  • 2015-11-03
  • 2012-06-28
  • 2010-10-07
  • 2023-03-16
  • 2011-03-02
  • 2013-08-28
相关资源
最近更新 更多