Open fedushok opened 2 years ago
How could be explained the difference in svg->png result between convert command and php-imagick?
The SVG conversion in ImageMagick is.....not as well tested against all libraries/delegates as might hope. There are possibly bugs.
How can I make php-imagick to use Inkscape as a delegate of IM?
I am slightly suprised it is not.
If your package manager is installing ImageMagick for you, and the command line tools are using the Inkscape delegate, then I would expect Imagick to use the same ImageMagick options...
Probably the easiest thing to try is:
phpize
./configure
make install
And then possible editing an appropriate ini file to load the extension with extension=imagick.so
. In case you don't know you can run php --ini
to see where PHP is looking for ini files.
Oh, I just saw "IM will use Inkscape if it is on the system path." elsewhere.
Hmm. I don't know this bit of ImageMagick. Try the above, but I may have to take a look deeper.
I compiled your extension. No result. The same third variant of png. after phpize i got the following
configure.ac:22: warning: $as_echo is obsolete; use AS_ECHO(["message"]) instead
build/php.m4:2111: PHP_CONFIG_NICE is expanded from...
configure.ac:22: the top level
configure.ac:165: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:165: You should run autoupdate.
build/libtool.m4:99: AC_PROG_LIBTOOL is expanded from...
configure.ac:165: the top level
Here is info about $PATH
env ->
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
phpinfo ->
Apache Environment PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
PHP Variables $_SERVER['PATH'] | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
They are quiet the same. Except "games".
which inkscape ->
/usr/bin/inkscape
3. I have IM, inkscape and imagick working on my 20.04 Ubuntu server. The only thing I remember, that i paid a lot of time to get the result. But i don't remember how it was.
info from server
phpinfo -> imagick module version => 3.4.4 (as i understand i didn't compile ext myself) imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel Imagick compiled with ImageMagick version => ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org Imagick using ImageMagick library version => ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
identify --version Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org Copyright: Ā© 1999-2019 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC Modules OpenMP Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib inkscape --version -> Inkscape 0.92.5 (2060ec1f9f, 2020-04-08)
4. After complete removal of imagick by synaptic I found that ini file was not deleted
/etc/php/8.1/cli/conf.d/20-imagick.ini
5. I had problems with IM + imagick (svg->png) always. On 18.04, 20.04, 22.04, even on windows. But now i know how to be with windows to get the result. What about Ubuntu NOBODY knows. NOBODY. I tried to find the solution in the internet - no one have 100% way to make this thing work. If somebody has the result, than his way is not good for somebody else.
For the sake of general knowledge: Does php7.4 extention API compartible with php8.1?
after phpize i got the following
So long as the other steps also work, that seems fine.
Does php7.4 extention API compartible with php8.1?
What you're asking is ambiguous. The code for Imagick can be compiled against PHP 5.4 to PHP 8.1 but there are parts that are compiled differently for the different versions of PHP.
i.e. the library imagick.so file that is built can only be used with the version of PHP that it was compiled against.
But now i know how to be with windows to get the result. What about Ubuntu NOBODY knows. NOBODY. I tried to find the solution in the internet - no one have 100% way to make this thing work. If somebody has the result, than his way is not good for somebody else.
It is a bit of a shitshow.
I'll try to summon the strength to investigate further. It's one of those annoying things that I know causes problems for people who use Imagick, but it's so hard to spend energy on investigating stuff that's probably not my fault.
Excuse me if said wrong thing. But if I launch
convert -verbose m.svg m.png
the output
'inkscape' '/tmp/magick-knd-yItHquAU0jJquWXQnfvJPv8t6bJ6' --export-filename='/tmp/magick-plR8fMbuiItBA6VpsTdTIoKn2Yb1FgvV.png' --export-dpi='96' --export-background='rgb(100%,100%,100%)' --export-background-opacity='0.99999999999900002212' > '/tmp/magick-0t3ydCG4Hm0m-EvlKKFBzTI0k0cQHxFF' 2>&1
/tmp/magick-plR8fMbuiItBA6VpsTdTIoKn2Yb1FgvV.png PNG 729x213 729x213+0+0 8-bit sRGB 15948B 0.010u 0:00.003
m.svg SVG 729x213 729x213+0+0 8-bit sRGB 15948B 0.000u 0:00.000
m.svg=>m.png SVG 729x213 729x213+0+0 8-bit sRGB 16112B 0.010u 0:00.013
IM will give right variant of png and as a delegate it will show 'Inkscape'. Because by default Inscape is the SVG processor of IM (if inkscape is installed). And I can't get the same thing on the same computer using php code.
function putPicture($im, $SVGString) // $im - IM object, $SVGString - my SVG
{
$SVG = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>';
$SVG .= '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">';
$SVG .= $SVGString;
$im->readImageBlob($SVG);
$im->setImageFormat('png');
$im->setImageType(Imagick::IMGTYPE_GRAYSCALE);
$path = '*****.png';
$im->writeImage($path);
$im->clear();
}
My php code processes SVG as if IM has only internal SVG processor.
Where should I go?
My php code processes SVG as if IM has only internal SVG processor.
Yeah, I get that. I just have no idea about the internals of ImageMagick, so I don't know how it checks for inkscape being available or not.
Reading the ImageMagick documentation for how the inkscape delegate is meant to be detected would be one thing that could be done. Or running the PHP code through strace (so like strace php foo.php > debug.txt 2&>1
) and trying to see where it's looking for inkscape would be one thing to try. Aka the thing I'm planning to do to investigate it.
I followed your advice about strace command. It is a first time I use it. I made three variants:
strace log files for each variant are attached .
I compared two variants: 1 and 2. There is a difference between them. For the second variant code loads svg.so, png.so libraries and for the first it doesn't. Code tries to attach to the path of input file: for the second variant - 'SVG:' and for the first variant - 'mvg:' If I attach 'SVG:' to the input files in convert command (like \ convert SVG:in.svg out.png \ ) I will get right conversion result.
If svg->png result doesn't depend on imagick, it will be good to get some arguments to address problem to IM programmers.
I just tried to download you SVG file you uploaded. It appears to have disappeared.
Can you re-upload it somewhere please and I'll grab it this time.
If svg->png result doesn't depend on imagick, it will be good to get some arguments to address
They have a lot of people asking for help, and eventually the problem is identified to be something that is related to how ImageMagick was installed. There's a limit to how much individual debugging they can do, and they often say "works for us please give us a repro case.
Thanks for the strace output. In it, I can see that 'delegates.xml' file is being found in a different place.
// First variant of png was made by convert command.
openat(AT_FDCWD, "/home/alexander/.config/ImageMagick/delegates.xml", O_RDONLY) = -1 ENOENT (No such file or directory)
// Second variant was made by php code.
openat(AT_FDCWD, "/etc/ImageMagick-6/delegates.xml", O_RDONLY) = 3
Can you check these two files and see if they are the same or different as each other.
fyi, the version of delegates.xml on my machine contains this hard to read line:
<delegate decode="svg:decode" stealth="True" command=""inkscape" "%s" --export-filename="%s" --export-dpi="%s" --export-background="%s" --export-background-opacity="%s" > "%s" 2>&1"/>
I wonder if that could be the difference?
delegate.xml - was the first thing I thought of. There is no any file on the path /home/alexander/.config/ImageMagick/delegates.xml
(as i understand if openat() = -1, then it is not found). If compare strace log files for not correct php conversion and conversion made by convert command - according to these files code looks for delegates.xml (6 times) and finds them (only one time) the same way
openat(AT_FDCWD, "/usr/local/etc/ImageMagick-6/delegates.xml", O_RDONLY) = 4
but the conversion results are different.
When I installed Inkscape (apt install ...), IM was one of dependencies and was also installed (apt install ...). I thought installation via command could gave me wrong delegates.xml. I found all delegates.xml, deleted them and after that compiled IM (without rsvg because it have bugs for my svg) one more time. The result was the same.
In the attachment you will find svg and my local delegates.xml.
I edited inkscape command string in delegates.xml to write errors in file. I tried it in php code. IM finds Inkscape, but there is a problem with one temporary file (/tmp/...). According to strace log there are another temporary files in /tmp/, but there is no mistakes with them in inkscape errors file.
/tmp/ owner - root, group - root, 1777.
In the attachment you will find errors.log (errors of inkscape session) and strace log file.
Just to check, is it okay to share the source SVG with the ImageMagick people?
I was just checking it against ImageMagick 7 (without inkscape), and it's close but not quite right:
The little indicator thingies are not quite in the right position, so I'll report that as a separate bug.
Still trying to understand what on earth is happening with inkscape...
btw, if you have a customer shouting at you to fix this.....there's no particular reason (imo) not to invoke inkscape directly to do the SVG conversion, as it's a pretty simple command line tool:
inkscape "m.svg" --export-filename="/var/app/bugReports/gh551/output_inkscape_directly.png" \
--export-dpi="96" \
--export-background="white" \
--export-background-opacity="255" > inkscape_output.txt 2>&1
The full manual page for inkscape appears to be here: https://inkscape.org/doc/inkscape-man.html
No problem with svg sharing. If I use Inkscape directly (most reasonable way), i will loose compartibility of my code with Windows. Most of time i have to work under Windows. And if i'm not mistaken i will have to give www-data group rights to execute programs ... I always had problems (ubuntu 18.04,20.04,22.04) with imagick-IM-inkscape. Eventually (except now) i got it working but i couldn't explain how.
I did the same with convert command. Inkscape gives only one warning
** (org.inkscape.Inkscape:3733): WARNING **: 23:12:16.063: Format autodetect failed. The file is being opened as SVG.
Background RRGGBBAA: ffffffff
Area 0:0:729:213 exported to 729 x 213 pixels (96 dpi)
php code doesn't say anything about format auto detect problem and convert says nothing about temp file problem!!!
here is strace log for convert
In the attachment you will find errors.log (errors of inkscape session) and strace log file.
It says "The transfer you requested has been deleted."...
Thanks....can you run strace again but with the -f
flag. So something like:
strace -f php debug.php > strace_output_with_follow.txt 2>&1
That will make it 'follow' the inkscape program when it's launched and see the system calls for it also.
tbh, I'm quite surprised that setting the permissions to that accessible didn't work. As well as the follow flag, can you use this debug code when generating the strace output, that directly invokes Inkscape, which may provide a clue:
<?php
declare(strict_types=1);
echo "Command line invoke\n";
copy(__DIR__ . "/m.svg", "/tmp/computers_were_a_mistake.svg");
$command = <<< COMMAND
inkscape "/tmp/computers_were_a_mistake.svg" \
--export-filename="/tmp/inkscape_output.png" \
--export-dpi="96" \
--export-background="white" \
--export-background-opacity="255" > inkscape_output.txt 2>&1
COMMAND;
$output = [];
$result_code = 0;
$result = exec($command, $output, $result_code);
var_dump($result_code);
var_dump($result);
var_dump($output);
echo "Raw PHP time\n";
$SVG = file_get_contents(__DIR__ . '/m.svg');
$im = new Imagick();
$im->readImageBlob($SVG);
$im->setImageFormat('png');
$im->setImageType(Imagick::IMGTYPE_GRAYSCALE);
$im->writeImage(__DIR__ . "/output.png");
And say whether /tmp/inkscape_output.png is created or not.
Actually I tried exec command (convert ... ) in php before. Before and now it works fine! Copy svg, creates my png in /tmp/ folder - the result is what I need. IM from php gives former result ...
here is attachment
Ok, so....what appears to be happening is:
ImageMagick generates a random file name in tmp, opens it, then removes it, all to ensure the tmp directory is usable:
openat(AT_FDCWD, "/tmp/magick-YbGf2FBRSUjGC775tto_DTJ2avTjfH13", O_RDWR|O_CREAT|O_EXCL, 0600) = 4
fchmod(4, 0600) = 0
close(4) = 0
unlink("/tmp/magick-YbGf2FBRSUjGC775tto_DTJ2avTjfH13") = 0
access("/tmp/magick-YbGf2FBRSUjGC775tto_DTJ2avTjfH13.cache", F_OK) = -1 ENOENT (No such file or directory)
ImageMagick symlinks your current working directory, to be inside the tmp directory:
getcwd("/home/alexander/imtest", 4096) = 23
symlink("/home/alexander/imtest/", "/tmp/magick-YbGf2FBRSUjGC775tto_DTJ2avTjfH13") = 0
newfstatat(AT_FDCWD, "/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}, 0) = 0
ImageMagick then invokes Inkscape, with that temporary symlink:
[pid 13472] execve("/bin/sh", ["sh", "-c", "'inkscape' '/tmp/magick-YbGf2FBR"...], 0x55a62f5d6eb0 /* 54 vars */ <unfinished ...>
And then inside Inkscape, Inkscape is trying to read that directory
[pid 13473] access("/tmp/magick-YbGf2FBRSUjGC775tto_DTJ2avTjfH13", F_OK) = 0
[pid 13473] openat(AT_FDCWD, "/tmp/magick-YbGf2FBRSUjGC775tto_DTJ2avTjfH13", O_RDONLY) = 14
[pid 13473] newfstatat(14, "", {st_mode=S_IFDIR|0777, st_size=4096, ...}, AT_EMPTY_PATH) = 0
[pid 13473] read(14, 0x560281636ee0, 4096) = -1 EISDIR (Is a directory)
[pid 13473] read(14, 0x560281636ee0, 4096) = -1 EISDIR (Is a directory)
[pid 13473] write(2, "/tmp/magick-YbGf2FBRSUjGC775tto_"..., 48) = 48
And failing...because it's a directory?
Can you run strace one more time please with an extra -s flag:
strace -f -s 256 php debug.php > strace_output_with_follow.txt 2>&1
Currently the string are chopped off after 32 bytes, and I'd like to double-check what I think I'm seeing before opening a bug upstream.
For the record, ImagickMagick calling inkscape is failing for me in a completely different way....
Inkscape is being invoked with:
execve("/usr/bin/inkscape", ["inkscape", "/tmp/magick-31PHE7pK6Rno3w", "--export-png=/tmp/magick-31OTI0EoNKptmy", "--export-dpi=96,96", "--export-background=rgb(100%,100%,100%)", "--export-background-opacity=1"]
And then barfing on the export-dpi count...
[pid 37] write(2, "Cannot parse double value ?96,96? for --export-dpi\n", 51) = 51
which is fun.
Actually, I've just realised you're using a not-up-to-date version of ImageMagick.
ImageMagick6-6.9.11-60 was apparently release on 25 Jan 2021. Maybe try updating to the latest ImageMagick?
I think I can. I prefer command "apt install" but I can compile. ImageMagick6-6.9.11-60 this version of IM is denoted in phpinfo of imagick part. That is why i use it. ImageMagick6-6.9.11-60 - was compiled on my compute. attachment
I can reinstall what ever you think it is nessessary (ubuntu, IM). I just want to solve the problem which is a long story for me.
May be I'm mistaken, but I saw using files after unlink in strace log for convert command (which works good).
I compiled IM6.9.12-58 (it is the latest IM6). Recompiled imagick. The same result with php code and convert command. Convert works fine, php code gives another result, but it is very bad.
Should I recompile imagick after IM?
Yes. Imagick needs to be compiled against ImageMagick to make sure it is using the correct compilation settings and library files.
Convert works fine, php code gives another result, but it is very bad.
Okay, that's odd. It seems to work for me.
Please can you do the:
strace -f -s 256 php debug.php > strace_output_with_follow.txt 2>&1
again please.
Oh, and can you post the configure settings you use with ImageMagick, so I can compile it exactly as you are.
To compile IM i do the following:
./configure
make
sudo make install
sudo ldconfig /usr/local/lib
convert -list configure ->
Path: /usr/local/lib/ImageMagick-6.9.12//config-Q16/configure.xml
Name Value
-------------------------------------------------------------------------------
CC gcc
CFLAGS -I/usr/include/libxml2 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/uuid -I/usr/include/cairo -I/usr/include/pixman-1 -pthread -I/usr/include/OpenEXR -I/usr/include/lqr-1 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/openjpeg-2.4 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/uuid -pthread -fopenmp -Wall -g -O2 -mtune=amdfam10 -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
CODER_PATH /usr/local/lib/ImageMagick-6.9.12/modules-Q16/coders
CONFIGURE ./configure
CONFIGURE_PATH /usr/local/etc/ImageMagick-6/
COPYRIGHT Copyright (C) 1999 ImageMagick Studio LLC
CPPFLAGS -I/usr/local/include/ImageMagick-6
CXX g++
CXXFLAGS -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib djvu fontconfig freetype heic jbig jng jpeg lcms lqr lzma openexr openjp2 pango png ps tiff webp x xml zlib
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-jemalloc=no --with-umem=no --with-autotrace=no --with-fftw=no --with-gslib=no --with-fontpath= --with-rsvg=no --with-wmf=no --with-perl=no
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick-6
EXEC-PREFIX /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES DPC Cipher OpenMP
FILTER_PATH /usr/local/lib/ImageMagick-6.9.12/modules-Q16/filters
GIT_REVISION a63a9cdc0:20220709
HOST x86_64-pc-linux-gnu
INCLUDE_PATH /usr/local/include/ImageMagick-6
LDFLAGS -L/usr/local/lib
LIB_VERSION 0x69C
LIB_VERSION_NUMBER 6,9,12,58
LIBRARY_PATH /usr/local/lib/ImageMagick-6.9.12
LIBS -ljbig -llcms2 -ltiff -lfreetype -ljpeg -llqr-1 -lglib-2.0 -lpng16 -lz -ldjvulibre -lfontconfig -lfreetype -lheif -lwebpmux -lwebpdemux -lwebp -lwebp -lXext -lXt -lSM -lICE -lX11 -llzma -lbz2 -lIlmImf-2_5 -lImath-2_5 -lHalf-2_5 -lIex-2_5 -lIexMath-2_5 -lIlmThread-2_5 -lopenjp2 -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lcairo -lxml2 -lz -lm -lpthread -lgomp
NAME ImageMagick
PCFLAGS -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX /usr/local
QuantumDepth 16
RELEASE_DATE 2022-07-09
SHARE_PATH /usr/local/share/ImageMagick-6
SHAREARCH_PATH /usr/local/lib/ImageMagick-6.9.12/config-Q16
TARGET_CPU x86_64
TARGET_OS linux-gnu
TARGET_VENDOR pc
VERSION 6.9.12
WEBSITE https://legacy.imagemagick.org
Path: [built-in]
Name Value
-------------------------------------------------------------------------------
DELEGATES bzlib djvu fontconfig freetype heic jbig jng jp2 jpeg lcms lqr lzma openexr pangocairo png tiff webp x xml zlib
FEATURES Cipher DPC OpenMP(4.5)
NAME ImageMagick
QuantumDepth Q16
no changes in debug.php running attachment
First, let me be clear, I may be losing my mind here. I am 99% sure it was working on my machine.
But when I tried the same code today, it wasn't working. So we can't rule out me having lost the plot.
Second, it is a bug in ImageMagick, and I'll report it upstream in a bit. The good news is you can make your code work, by reading the image from a file:
$im1 = new Imagick(__DIR__ . '/m.svg');
$im1->writeImage(__DIR__ . "/output_opening_file.png");
Output is:
$SVG = file_get_contents(__DIR__ . '/m.svg');
$im2 = new Imagick();
$im2->readImageBlob($SVG);
$im2->writeImage(__DIR__ . "/output_opening_blob.png");
Output is:
I'm getting the same strace error you are seeing, where inkscape is being told to open a directory, not an image file.
Going to make a simple repro case in C.
makes for me IM installation a "subtle, sophisticated, without guarantee (and so on)"
Yeah.......it's not a great situation. But one that doesn't have an obvious great way of improving it.
But I couldn't make it directly because of problem in php code.
Yeah, I saw that. But the ImageMagick people have a huge number of bug reports that are due to either stuff misconfigured on the users computer, the user just making a mistake, or the problem lies in a downstream library.
They don't have enough funding to dig into every problem a user faces.
I've been putting off looking into the unreliability of the SVG processing for years, and just happened to feel like investigating this one.
do you need to make some changes in imagick?
No. Imagick is a really thin wrapper and doesn't do much tbh, which is both good and bad.
I'll leave this open though until the fix is committed upstream and I've checked it.
i have a similar problem with php imagick not using inkscape. while command magick test.svg test.pdf
works as expected
my problem is linked images in xlink:href which worked fine with imagick 6 and failing with imagick 7.
my script runs on Ubunut 20.04 php 8.1.8 and ImageMagick 7.1.0-43 Q16-HDRI x86_64
i'm testing with simple php script
$imagick->readImageBlob(file_get_contents('tmp/test.svg'));
$imagick->setImageFormat('pdf');
$saving_handle = fopen('tmp/test.pdf', 'a+');
$imagick->writeImageFile($saving_handle);
and from command line magick test.svg test.pdf when i remove inkscape from system command line stops working with rsvg.
i tried your suggestion to open svg inside new Imagick() but it fails for me with the following error
ImagickException with message 'delegate failed `'potrace' --svg --output '%o' '%i'' @ error/delegate.c/InvokeDelegate/1911'
i reported similar issue/asked for help but it had https image linked. which i still need working but can do a workaround(by downloading them and changing svg on the fly). https://github.com/ImageMagick/ImageMagick/discussions/5001 https://github.com/ImageMagick/ImageMagick/issues/5003
@guruas3 Please open a new issue with an example file to test.
It sounds like a completely different issue to this one.
@Danack sorry modified my comment many times. i just thought it was related to not using inkscape just from php. i will do if you see that it's different
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+ ImageMagick's 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 are rendered correctly in the Inkscape and various browsers.
If compile IM without --with-png=yes option, then php code gives third variant of png. Convert command gives first variant of png. According to convert -verbose ... IM uses Inkscape as a delegate.
Questions: