imagick not converting webp format on Amazon Linux - php

imagick convert command is not working for this webp image -
https://lh3.googleusercontent.com/VRY0O_3L8VH2wxJSTiKPr72PeM5uhPPFEsHzzYdxenddpTI150M0TYpljnZisQaROR0=h256-rw -
convert -resize 50x50! https://lh3.googleusercontent.com/VRY0O_3L8VH2wxJSTiKPr72PeM5uhPPFEsHzzYdxenddpTI150M0TYpljnZisQaROR0=h256-rw /var/test_sandeepan/output.jpg
Output -
convert: no decode delegate for this image format `WEBP' # error/constitute.c/ReadImage/535.
From this, I conclude that webp is either not supported by Imagick at all, or not supported by this version.
A link shared in this answer, talks about webp support along with imagemagick and php, so I thought imagick must be supporting webp as well, because PHP imagemagick, as per my understanding is nothing but a wrapper class to the imagick utility. Please correct me if I am wrong here.

I conclude that webp is either not supported by Imagick at all, or not supported by this version.
Imagick doesn't really do anything. All it does is convert PHP function calls into C function calls, to call the ImageMagick code through its 'wand' API.
If you want to have ImageMagick support webp, you will either need to install a version that has been compiled with webp support compiled in, or compile it yourself: http://www.imagemagick.org/script/advanced-unix-installation.php
You'll need to install libwebp-devel either from apt/yum, or from https://github.com/webmproject/libwebp as ImageMagick relies on that 'delegate' code being there to read/write webp images.

Related

Enable webp in php 7 without recompiling

Is it possible to enable gd webp support in PHP 7.4 on debian (with nginx) without recompiling php? All solutions I found recompile PHP7 with the --with-webp-dir param.
You can sort of do it. Save an image file on your server, and then convert it to WebP.
See: How to Enable WebP support Php 7 without Recompiling?
I agree, it is not perfect, but quite close.

Enabling gd webp on AWS EC2 instance

I'm having an issue trying to use Intervention Image to manipulate webp files. The statement causing the error is:
Image::make($image->getRealPath())->resize(250, 250)->save($path);
The error I run into is:
Unsupported image type. GD/PHP installation does not support WebP format.
I have the gd library installed, however it does not support webp.
I've looked around, and the closest I've found to a solution is here, which suggests adding additional extensions when initially (manually) compiling PHP: Call to undefined function imagewebp()
I would prefer not to uninstall and manually compile PHP with additional extensions. Is this the only option? Are there any straightforward solutions?

Convert SVG to PNG with GD

I want to convert an SVG image to a PNG in PHP. I know how to do it in Imagemagick but I dont get it to work on my Webserver and it seems SVG support is not very good with imagemagick.
So how can I do it with GD and is SVG even supported?
Sadly, GD2 does not support SVG. I had to install a unix virtual machine and I am trying with Imagick, that supports SVG.

check for ghostscript support in php imagick?

is it possible to check the php imagick extension for ghostscript support?
for example if it is turned on / off, the ghostscript version used, etc.
which possibilities are there to get additional ghostscript / pdf details?
the only thing i've found so far is this (version of imagick lib itself):
http://php.net/manual/en/imagick.getversion.php
ps: no system calls are allowed (e.g. exec) from within php
I don't know much about imagick, but some things about imagemagick. My guess is that by reading this answer related to imagemagick could help you with imagick as well:
convert -list delegate | grep -Ei '(PDF|PS|EPS)'
(convert is one of the CLI utilities which are part of imagemagick.)

What are the differences between a GD and a GD2 image?

Reading the documentation for imagegd2(), and imagegd(), I noticed the functions are described, respectively as:
Output GD2 image to browser or file
Output GD image to browser or file
What are a GD2, and a GD image? What are the difference between those image types?
gd is an old c library, gd2 is the updated one. php uses gd2.
Some version of GD generates only PNG, but recent version can ganerate GIF and PNG. Soon GD 1 will be no longer supported in next version of PHP.

Categories