Page 1 of 1

SVG and clipping path

Posted: 2019-08-13T10:27:15-07:00
by JeroenOnline
Hello,

I'm facing trouble with the php imagick conversion of an svg to png. The clippingmask deletes the image completely and replaces it with a black color. When I try the same conversion in say inkscape it works just fine, anybody can help me with this?
Image
SVG: https://pastecloud.net/OsSRON7Zcg

Greetings!

Re: SVG and clipping path

Posted: 2019-08-13T10:38:27-07:00
by fmw42
Works fine for me using IM 6.9.10.60 Q16 Mac OSX with Inkscape as the SVG renderer from command line. I see a picture of a baby.

It is likely your SVG renderer. There are 3 possible: ImageMagick default MSVG/XML, RSVG delegate, Inkscape. The latter are better than MSVG. Check which you are using with ImageMagick on Imagick. Or be sure you have a current version of ImageMagick and install Inkscape. ImageMagick will use that if it is found.

Re: SVG and clipping path

Posted: 2019-08-13T10:41:46-07:00
by JeroenOnline
Thanks for the very quick response, how can I check from PHP wich renderer I'm using? And even better how can I cange which one is being used.

By the way in addition this is the code I use in PHP to create the jpg.

Code: Select all

        $image = new Imagick();
        $image->readImage(storage_path('Geboortekaartje-Octo-1.svg'));
        $image->setImageFormat('jpg');

        file_put_contents(storage_path('Geboortekaartje-Octo-1.jpg'), $image);
And the information from the imagick module used.
Image

Re: SVG and clipping path

Posted: 2019-08-13T11:16:51-07:00
by fmw42
Sorry, I am not an expert no Imagick. But if you install Inkscape on the system, then ImageMagick will use it automatically, if it can find Inkscape. The only way to know which renderer is likely to use -verbose in the command line. So use PHP exec() with the command line convert to process your svg file including -verbose in the command line.

Re: SVG and clipping path

Posted: 2019-08-13T11:22:17-07:00
by JeroenOnline
fmw42 wrote: 2019-08-13T11:16:51-07:00 Sorry, I am not an expert no Imagick. But if you install Inkscape on the system, then ImageMagick will use it automatically, if it can find Inkscape. The only way to know which renderer is likely to use -verbose in the command line. So use PHP exec() with the command line convert to process your svg file including -verbose in the command line.
Allright thank you I just runned the command manually from the command line and it gave me "Aborted" back no further output is my command wrong?

Code: Select all

convert testimage.svg test.png
with the verbose flag

Code: Select all

convert testimage.svg test.png -verbose
gave me aborted aswell.

Re: SVG and clipping path

Posted: 2019-08-13T11:53:17-07:00
by fmw42
try

Code: Select all

convert -verbose testimage.svg test.png
But if

Code: Select all

convert testimage.svg test.png
aborts, then it would seem that something is wrong with your ImageMagick version install.

What do you get from

Code: Select all

convert -version
If that works, then what do you get for the line starting with SVG in the following result:

Code: Select all

convert -list format

Re: SVG and clipping path

Posted: 2019-08-13T11:56:40-07:00
by snibgo
JeroenOnline wrote:convert testimage.svg test.png -verbose
The last argument should be the output filename. Not "-verbose" or anything else. Try:

Code: Select all

convert -verbose testimage.svg test.png

Re: SVG and clipping path

Posted: 2019-08-14T04:44:33-07:00
by JeroenOnline
Thank you very much both!
fmw42 wrote: 2019-08-13T11:53:17-07:00 try

Code: Select all

convert -verbose testimage.svg test.png
But if

Code: Select all

convert testimage.svg test.png
aborts, then it would seem that something is wrong with your ImageMagick version install.

What do you get from

Code: Select all

convert -version
If that works, then what do you get for the line starting with SVG in the following result:

Code: Select all

convert -list format
Convert verbose gives me:

Code: Select all

 convert -verbose Geboortekaartje-Octo-1.svg test.png
"inkscape" "Geboortekaartje-Octo-1.svg" --export-eps="/tmp/magick-37767nPLbA_doiGwI" --export-dpi="90,90" --export-background="rgb(100%,100%,100%)" --export-background-opacity="1" > "/tmp/magick-37767cbwD7Suw2XNE" 2>&1
Aborted
Convert version:

Code: Select all

 convert -version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2019-06-15 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib
And last convert -list format:

Code: Select all

SVG  SVG       rw+   Scalable Vector Graphics (RSVG 2.40.13)
     SVGZ  SVG       rw+   Compressed Scalable Vector Graphics (RSVG 2.40.13)

Re: SVG and clipping path

Posted: 2019-08-14T05:20:47-07:00
by snibgo
wrote:convert -verbose Geboortekaartje-Octo-1.svg test.png
"inkscape" "Geboortekaartje-Octo-1.svg" --export-eps="/tmp/magick-37767nPLbA_doiGwI" --export-dpi="90,90" --export-background="rgb(100%,100%,100%)" --export-background-opacity="1" > "/tmp/magick-37767cbwD7Suw2XNE" 2>&1
Aborted
This suggests Inkscape isn't working properly. Can you run Inkscape interactively? If so, can Inkscape read that SVG and display it? Can you run that Inkscape command from the command line?

Your version on IM creates the Inkscape command to output an EPS file, so this also needs Ghostscript. So it could be a problem with Ghostscript. Is that also installed?

Re: SVG and clipping path

Posted: 2019-08-14T05:50:52-07:00
by JeroenOnline
My issue seems to be related to this issue: https://gitlab.com/inkscape/inkscape/issues/294. I'll do some further investigation.

Re: SVG and clipping path

Posted: 2019-08-14T09:04:14-07:00
by fmw42
Try removing and upgrading Inkscape. Be sure it install with no errors and has all needed delegates installed for it.