PHP ImageMagick是否有办法将页面数计入TIF图像文件中,而无需加载完整的文件?
让我描述场景。
Environemnt :Redhat Linux 7.9 + ImageMagick* + PECL Imagick + PHP脚本。
范围:必须允许进入GUI应用程序用户从多TIF文件中查看单个图像。
文件: Multi-Tiff文件被jpeg压缩。
问题: 我有包含n张图像的TIF文件,总尺寸从几个MB到1/2GB,我需要以两种方式访问它们:
[ ko ]需求计算图像的总数包含在tif中的图像。
$ img = new Imagick($ filename); $ img-> getnumberimages();
使用这种访问方式,PHP类需要很长的时间将TIF加载〜2612张图像,约498m,如15秒。(未压缩的TIF约为1.3G)。
[ ok ] 访问#n image 进入TIF,以允许用户查看每个单个图像。
$ img = new Imagick($ filename。“ [1]”); $ img-> setImageFormat(“ jpeg”);
>$ thumbnail = $ img-> getImageBlob();
它是' ok '
**两个点1/2均通过不同的Imagick库版本进行了测试:6.7.8-9,6.9.10-68 Q16,7.1.0(Q16 HDRI)[pecl Imagick 3.4或3.7] + GraphicsMagick-1.3.36,但是没有有意义的区别。
是否可以将图像的数量纳入TIF,而无需使用时间以 Imagick PHP类初始化完整的TIF ?
let me describe the scenario.
Environemnt: RedHat linux 7.9 + ImageMagick* + pecl imagick + PHP script.
Scope: Into GUI application user must be allowed to see the single images from a multi-TIF file.
File: multi-tiff file are JPEG compressed.
Problem:
I have TIF file that contains N images, total size from few MB to 1/2GB and I need to access to them in two way much faster as possible:
[KO] Need to count the total number of images contained into TIF.
$img = new Imagick($filename); $img->getNumberImages();
With this way of access, the php class takes quite long time to load a TIF with ~2612 images,about 498M, like 15 seconds.(uncompressed tif is about 1.3G).
[OK] Access to the #n image into TIF to allow the user to see each single image.
$img = new Imagick($filename."[1]");$img->setImageFormat("jpeg");
$thumbnail = $img->getImageBlob();
It is 'OK' because the speed is high for the scope (always less than (and far from) 1 second)
** Both point 1/2 was tested with different imagick library version: 6.7.8-9, 6.9.10-68 Q16, 7.1.0 (Q16 HDRI) [pecl imagick 3.4 or 3.7] + GraphicsMagick-1.3.36, but there aren't a meaningful difference.
Is there an alternative to get the number of images into TIF without using time to initialize the full tif with Imagick php class?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我意识到您要求您进行ImageMagick,但是 php-vips 可以很快这样做。我尝试了:
我看到:
因此,使用1.4GB,2600页tiff,它可以在300毫秒内获取和缩略图。
I realize you asked for imagemagick, but php-vips can do this pretty quickly. I tried:
I see:
So with a 1.4gb, 2600 page TIFF it can fetch and thumbnail a page in about 300ms.