SVG and clipping path
-
- Posts: 5
- Joined: 2019-08-13T10:22:27-07:00
- Authentication code: 1152
SVG and clipping path
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?
SVG: https://pastecloud.net/OsSRON7Zcg
Greetings!
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?
SVG: https://pastecloud.net/OsSRON7Zcg
Greetings!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: SVG and clipping path
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.
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.
-
- Posts: 5
- Joined: 2019-08-13T10:22:27-07:00
- Authentication code: 1152
Re: SVG and clipping path
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.
And the information from the imagick module 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);
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: SVG and clipping path
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.
-
- Posts: 5
- Joined: 2019-08-13T10:22:27-07:00
- Authentication code: 1152
Re: SVG and clipping path
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?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.
Code: Select all
convert testimage.svg test.png
Code: Select all
convert testimage.svg test.png -verbose
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: SVG and clipping path
try
But if
aborts, then it would seem that something is wrong with your ImageMagick version install.
What do you get from
If that works, then what do you get for the line starting with SVG in the following result:
Code: Select all
convert -verbose testimage.svg test.png
Code: Select all
convert testimage.svg test.png
What do you get from
Code: Select all
convert -version
Code: Select all
convert -list format
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: SVG and clipping path
The last argument should be the output filename. Not "-verbose" or anything else. Try:JeroenOnline wrote:convert testimage.svg test.png -verbose
Code: Select all
convert -verbose testimage.svg test.png
snibgo's IM pages: im.snibgo.com
-
- Posts: 5
- Joined: 2019-08-13T10:22:27-07:00
- Authentication code: 1152
Re: SVG and clipping path
Thank you very much both!
Convert version:
And last convert -list format:
Convert verbose gives me:fmw42 wrote: ↑2019-08-13T11:53:17-07:00 try
But ifCode: Select all
convert -verbose testimage.svg test.png
aborts, then it would seem that something is wrong with your ImageMagick version install.Code: Select all
convert testimage.svg test.png
What do you get from
If that works, then what do you get for the line starting with SVG in the following result:Code: Select all
convert -version
Code: Select all
convert -list format
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
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
Code: Select all
SVG SVG rw+ Scalable Vector Graphics (RSVG 2.40.13)
SVGZ SVG rw+ Compressed Scalable Vector Graphics (RSVG 2.40.13)
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: SVG and clipping path
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?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
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?
snibgo's IM pages: im.snibgo.com
-
- Posts: 5
- Joined: 2019-08-13T10:22:27-07:00
- Authentication code: 1152
Re: SVG and clipping path
My issue seems to be related to this issue: https://gitlab.com/inkscape/inkscape/issues/294. I'll do some further investigation.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: SVG and clipping path
Try removing and upgrading Inkscape. Be sure it install with no errors and has all needed delegates installed for it.