Converting a TIFF image to PNG/JPG/GIF in PHP without Imagick - php

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.
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.
Nor is PDFLib installed on the server (which supports importing tiffs into a PDF).
Thanks.

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

Related

how to make WebP image from existing image files in php

I know there are packages in Laravel like this for converting PNG/JPG images to WebP but this package is in php7.1 so we cannot use it for technical reasons, there is also an imagewebp() function in php which we would like to use it, but I cannot find any documentation for how to read an already existing image and give it to the function to convert it to the WebP image. Does any one have a solution on how to read an image file and give it convert it to the WebP images using the PHP extensions?

How can i convert a svg image to png image with Imagemagick when the svg file has embedded images?

With PHP i'm creating an image with embedded content (base64 encoded files). If i see it using Firefox, or downloading it and then opening it with Inkscape (www.inkscape.org), the image is fine!.
But when i try to convert it using imagemagick (using convert command or with Imagick support for PHP) the embedded image doesn't come in with the final result.
I don't know if there is a special command or configuration i'm missing. I'm not using any special setup. Just ...
convert image.svg image.png
Thank you very much for your answer.
ImageMagick's built-in SVG rendering is really pretty horrible. Don't use it if you can avoid it. I'd recommend using librsvg instead, either using the command-line rsvg tool, or possibly with the PHP rsvg extension.
(Librsvg's rendering isn't always perfect either, but it should be able to handle embedded images just fine. If you want even better rendering, you could always try using Inkscape from the command line.)
Is the embedded image in PNG or in Jpeg format? What converter is used in PHP? I tried on Windows with latest ImageMagick, which doesn't come with RSVG. I found a RSVG-Converter build for Windows, and, while it does a good job, it skips the Jpeg version of the image of a test file.
On the other hand, the built-in converter handles correctly both images, but does an awful job on the home image shown in the SVG tutorial.

php Image processing (convert jpeg to png or gif or wbmp)

The situation is like this :
A server returns me a picture which is in jpeg format. Now I have to do some processing on the image (like writing caption on it,..). Since my server does not support jpeg, I want to convert it to a format that my server supports(png,gif and wbmp). How can I convert the image returned by the server into png/gif/wbmp format without using imagecreatefromjpeg ?
Try Imagine http://imagine.readthedocs.org/en/latest/index.html
In what way does your server not support jpeg? are you saying that the imagecreatefromjpeg() function is not available in your PHP?
Assuming this is the case, then it doesn't mean that your server "doesn't support jpeg"; what it means is that your copy of PHP doesn't have the GD library installed. This will affect all PHP's graphic processing functions, not just JPEG ones.
If you have the ability to install PHP extensions, or to ask your server admin to install them, then installing the GD library will be by far the easiest solution to this problem.
If you don't have that ability, you will still need to install something onto your server in order to read and process an image (of any type, not just jpeg).
A common tool for this is ImageMagick. This is a stand-alone tool, so you can install it and call it from the command line (ie using PHP's exec command, etc). There is also a PHP extension to control it, but obviously this will have the same issue as the GD library if it isn't already installed.
But ultimately, whatever you do, it will involve installing something on your server.

Conversion of an Adobe PDF to the JPEG

Is there any ready PHP-based soultiuon for creation of an JPEG images from the Adobe's PDF files? Just like this: http://www.convertpdftoimage.com/
The ImageMagick program allows conversion between graphic formats, and it includes support for reading PDF files. Therefore it should be able to convert PDF to JPG. (indeed, googling for ImageMagick pdf to jpg gives plenty of results, with good usage examples)
Furthermore, there is a PHP extension for ImageMagick, so if you have that extension included in your PHP, then it should be pretty simple (you can check which extensions are included in a given PHP installation by using the phpinfo() function).
If you don't have that extension (and you can't install it), you can still use ImageMagick, using it's command-line interface via the PHP shell_exec() function, etc.
I don't know about PHP. But we use this application: Callas pdfToolbox. It's standalone on your UNIX server.
Apache provides a Java solutions: PDFBox
Not sure PHP is capable of rendering PDF's. Getting the text out of then however should be easy.

Convert PDF to images in php

These are the steps I am trying to achieve:
1) Upload a PDF document on the server.
2) Convert the PDF document to a set of images, and saving them.
Any ideas for doing #2 using php??
If you have the ImageMagick extension compiled into PHP, it should be able to read in PDFs and convert them to any common image format. I don't believe the GD extension (which is more common) has PDF capabilities, sadly.

Categories