在PHP中将TIFF图像转换为PNG/JPG/GIF而不使用Imagick

时间:2022-10-14 21:15:27

I am working on a website for my client in which tiff images need to converted to png or jpg before they are assembled into a PDF.

我正在为我的客户开发一个网站,其中tiff图像需要转换为png或jpg格式,然后才能组装成PDF格式。

I have read many articles, here and other sites, on this issue. They all recommend using Imagick to accomplish this. The problem is, my client's server does not have that extension installed, and the hosting company is unwilling to install the extension.

我在这里和其他网站上读过很多关于这个问题的文章。他们都建议使用Imagick来实现这一点。问题是,我的客户端服务器没有安装这个扩展,托管公司不愿意安装这个扩展。

Nor is PDFLib installed on the server (which supports importing tiffs into a PDF).

也没有在服务器上安装PDFLib(它支持将tiff导入到PDF中)。

Thanks.

谢谢。

1 个解决方案

#1


2  

This is tricky because of the tiff format. You can do this for most input formats with native PHP functions to create an image object from the source file and then save that using imagejpeg or imagepng. But tiff has patent issues and I don't think it's supported. Have a look at the PHP GD and image functions available on your server. May be some help in the comments here: http://php.net/manual/en/function.pdf-open-image-file.php

这很棘手,因为tiff格式。对于大多数使用本机PHP函数的输入格式,都可以这样做,以便从源文件创建一个图像对象,然后使用imagejpeg或imagepng将其保存。但是tiff有专利问题,我不认为它被支持。查看服务器上的PHP GD和映像函数。可能在这里的评论中有一些帮助:http://php.net/manual/en/function.pdf- openimage -file.php ?

#1


2  

This is tricky because of the tiff format. You can do this for most input formats with native PHP functions to create an image object from the source file and then save that using imagejpeg or imagepng. But tiff has patent issues and I don't think it's supported. Have a look at the PHP GD and image functions available on your server. May be some help in the comments here: http://php.net/manual/en/function.pdf-open-image-file.php

这很棘手,因为tiff格式。对于大多数使用本机PHP函数的输入格式,都可以这样做,以便从源文件创建一个图像对象,然后使用imagejpeg或imagepng将其保存。但是tiff有专利问题,我不认为它被支持。查看服务器上的PHP GD和映像函数。可能在这里的评论中有一些帮助:http://php.net/manual/en/function.pdf- openimage -file.php ?