No formats supported in PHP/ImageMagik/imagick - php

I've installed pecl-imagick from FreeBSD ports and it can't do a thing with images.
phpinfo() reports this:
ImageMagick number of supported formats: 0
ImageMagick supported formats: no value
But ImageMagick installed correctly and show all it's stuff:
$ convert -list configure
...
DELEGATES bzlib fftw fontconfig jpeg jng lzma png zlib
...
What could be wrong and how to fix it?

I found that having an extension for GraphicsMagick (a "better" fork) installed causes that.
If you don't feel how it makes any sense, I'm totally with you.

Did you install PHP from ports? Update your ports and re-install packages.

Related

Not correct convertation svg->png using php code

My svg file (m.svg)
I got some variants of svg->png conversation
First variant of png (right version):
Second variant of png:
Third variant of png:
First variant of png was made by convert command.
Second variant was made by php code.
My programs:
Ubuntu 22.04
php 8.1.7
Inkscape 1.1.2 (0a00cf5339, 2022-02-04) libxml2 librsvg2-dev (sudo apt
install ... )
ImageMagick6-6.9.11-60 ( ./configure --with-png=yes --with-rsvg=yes && make && sudo make
install && sudo ldconfig /usr/local/lib) (in phpinfo it is said that php-imagick 3.7.0 was compiled with this
version of IM)
php-imagick 3.7.0 (sudo apt install ... )
Information given by some commands:
identify -list format | grep SVG ->
MSVG* rw+ ImageMagicks own SVG internal renderer
SVG* rw+ Scalable Vector Graphics (RSVG 2.52.5)
SVGZ* rw+ Compressed Scalable Vector Graphics (RSVG 2.52.5)
phpinfo -> ImageMagick supported formats: … , MSVG, ... SVG, SVGZ, ...
convert -list configure ->
...
DELEGATES cairo fontconfig freetype jbig jng jpeg lzma png rsvg tiff x xml zlib
...
identify --version ->
Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-24 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC OpenMP(4.5)
Delegates (built-in): cairo fontconfig freetype jbig jng jpeg lzma png rsvg tiff x xml zlib
Results given by some commands:
rsvg-convert -o m1.png m.svg -> second variant of png
convert m.svg m.png -> first variant of png
convert SVG:m.svg m.png -> first variant of png
convert MSVG:m.svg m.png -> third variant of png
rsvg-convert gives the second variant of png (not correct). I tested another svg files (with another mistakes) and got the same result with the result made by php code.
All my svg files are rendered correctly in the Inkscape and various browsers.
If compile IM without --with-png=yes option, then php code and convert command gives third variant of png.
My questions are:
How to make php-imagick - imagemagick convert svg->png correctly?
How could be explained the difference in svg->png result between
convert command and php-imagick? As i understand convert command and
php-imagick use the same imagemagick, but the results are different.
How can I know which delegate IM uses by default?

Imagemagick tiff installed and working but php Imagick extension supports no tiff

I'm running xampp on macOS (10.12.6) and installed Imagemagick (ImageMagick 7.0.7-3 Q16 x86_64 2017-09-19 ).
With the installed php Imagick extension, I can convert in php images from jpeg to png without problems.
But when I want to convert from tiff to png/jpeg, it doesnt work with the Imagick extension. But it works in terminal and the Imagemagick tiff DELEGATE is supported.
When I look at phpinfo(), there's no tiff support listed.
the PHP error is:
Uncaught ImagickException: unable to load module
'/usr/local/Cellar/imagemagick/7.0.7-3/lib/ImageMagick//modules-Q16HDRI/coders/tiff.la':
file not found # error/module.c/OpenModule/1270
Is the problem the double-backslash in the path?
When I navigate in the finder to the path with doubleback-backslash removed, there is the correct file.
I found the solution among the answers to issue #3919 for Homebrew on GitHub.
Try recompiling php-imagick71 and imagemagick one or several times in different order.
brew reinstall -s php-imagick71
brew reinstall -s imagemagick

Proplems with PHP installation with jpeg, png and freetype support

I'm setting up Typo3 on a Mac and it has an install tool that tells you what you need to change about your system in order to use it.
It said I needed to reinstall PHP with jpeg, png and freetype GD support.
So I downloaded the latest version of PHP and the jpeg, png and freetype libraries.
I configured, made and installed each library.
Then I configured PHP thusly:
./configure --enable-exif --enable-ftp --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-freetype-dir=/usr/lib --with-mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-gd=usr/lib
Then I made clean, made and installed PHP.
Then replaced php.ini with a copy of the new php.ini-development.
I thought I was done, but the Typo3 install tool still tells me I still need to set up jpeg, png and freetype support for PHP. Furthermore, going to info.php in my browser gives me information about the previous installation.
It's driving me crazy. What have I done wrong?
Thanks.

php5-imagick on Ubuntu 14.04

I've spent quite some time googling for this issue, but to no avail, so I was hoping to get some help out here.
I'm using Ubuntu 14.04 and I've installed php5-imagick, ImageMagick and some extra libs for it to function. Testing the installation from the command line works perfectly and all delegates are installed according to 'convert -list configure' (output shown below).
It was working and performing perfectly before. The only thing I can think of is some system/security updates of Ubuntu. My code nor the IM installation were changed by any user actions before this error showed up.
The problem is when I call Imagick from my PHP script, it shows this error:
#420: no decode delegate for this image format '/' # error/constitute.c/ReadImage/544
This error is shown for both JPG and PNG.
Any help is greatly appreciated!
Output of 'convert -version':
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
Output of 'convert -list configure':
DELEGATES bzlib djvu fftw fontconfig freetype jbig jpeg jng jp2 lcms2 lqr lzma openexr pango png rsvg tiff x11 xml wmf zlib
LIBS -lMagickCore -llcms2 -ltiff -lfreetype -ljpeg -llqr-1 -lglib-2.0 -lfftw3 -lfontconfig -lfreetype -lXext -lSM -lICE -lX11 -lXt -llzma -lbz2 -lz -lm -lgomp -lpthread -lltdl
I think the problem here is that Imagemagick isn't configured to support SVG. Installing basic php5-imagick package doesn't bring in some extras which you'll need for doing this.
To install support for SVG in PHP Imagick type the following into a terminal on the server in question:
sudo apt-get update
sudo apt-get install libmagickcore5-extra
Apt will list a load of dependent packages, including SVG libraries, and will ask you if you'd like to continue. Press Y and let it get on with it.
It appears that you're trying to open the file named '/'.
Strangely enough Imagick is not able to open that file.
Try passing in a real image filename.
Check the file to be processed with the vim command. Probably not an image.
I had a similar problem. You can see it here:
ImageMagick on Ubuntu 14.04 No decode delegate

imagemagick cannot read these files

I have jasper installed and the lastest version of imagemagick. When I attempt to process these two files: here and here
I get a decode error. Can anyone let me know which other packages I need to install for imagemagick to read these files properly?
Has your IM been compiled with --with-jpeg=no or --without-jpeg?
Or did the compilation fail to include JPEG support because of a lack of decoder libraries being installed? You need libjpeg installed, and the development header files for that library.
You can find out what formats are supported by issuing the command:
$ identify -list format
If you state your OS (inc. distribution if Linux) and how you installed IM, you might get more information on how to resolve it. If you are on linux the package names are probably libjpeg and libjpeg-devel.

Categories