How to Convert Compressed Image File Formats to Uncompressed Image File Formats in PHP
I have a question about image compression. Does anyone know how to uncompress images such as jpg, p开发者_如何学编程ng and such into file formats such as tiff or bmp and vice versa via PHP or any other scripting language? Is there some library to do this?
Thanks in advance for any help! :)
Sincerely, Piotr.
There is a library called GD which does this. However there are other libraries as ImageMagick and GraphicsMagick (GMagick) that can do that as well.
The principle with any of these libraries is:
- Open the picture
- Save the picture in the format of your wish (TIFF, BMP, ...)
I would not recommend the GD library as it does not support the file-types you're asking for (TIFF, BMP).
Next to using libraries, you can invoke a command-line tool that will convert image files like ImageMagick or GraphicsMagick.
The advantages of doing so are questionable. Compression works by losing some information in which case, the problem you're potentially trying to solve probably won't be solved. i.e. you'll still have dithering and the like.
精彩评论