Embedded images in SVG are colour inverted when converted to PNG

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
hairykid
Posts: 10
Joined: 2019-03-12T08:30:40-07:00
Authentication code: 1152

Embedded images in SVG are colour inverted when converted to PNG

Post by hairykid » 2019-05-17T02:14:28-07:00

OS: Ubuntu 18.10
Version: ImageMagick 7.0.8-45

The command being run is -

convert +antialias msvg:/var/www/mydomain.co.uk/sites/default/files/tmp/preview-1359776017-m0PrE8 png:/var/www/mydomain.co.uk/sites/default/files/tmp/preview-1033156707-Hxugpl

To replicate issue -

The svg image used is here - https://ufile.io/5fk9e1e6

The converted png is here - https://ufile.io/gfwcio9g

User avatar
fmw42
Posts: 24886
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Embedded images in SVG are colour inverted when converted to PNG

Post by fmw42 » 2019-05-17T09:13:29-07:00

Imagemagick will use any one of 3 SVG renderers: MSVG, RSVG and Inkscape. MSVG is not as good as the other and Inkscape is the best.

In IM 7, use magick not convert.

I do not see your SVG file listed in your command?

But if I use MSVG in IM 7.0.8.45 Q16 Mac OSX as:

Code: Select all

magick MSVG:original.svg orig_msvg.png
I reproduce your image. But using Inkscape with Imagemagick, I get a different result, which seems to be missing the imbedded JPG image in the SVG file.

Code: Select all

magick original.svg orig.png
Image

The preview in my Mac OSX does look inverted showing cyan-like colors. But I suspect it is an issue with the preview, not the image.

User avatar
fmw42
Posts: 24886
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Embedded images in SVG are colour inverted when converted to PNG

Post by fmw42 » 2019-05-17T09:25:40-07:00

You have an imbedded CMYK JPG in the SVG file (Logo 1_1.jpg). So that might be showing with inverted colors in an SVG file.

hairykid
Posts: 10
Joined: 2019-03-12T08:30:40-07:00
Authentication code: 1152

Re: Embedded images in SVG are colour inverted when converted to PNG

Post by hairykid » 2019-05-20T01:47:47-07:00

Hi, we have tested with CMYK and it works fine. My collegue seems to now think it is the filesize of the image since the same image made smaller works fine.

This is a pretty old website and hence changing everything from MSVG may not be cost-effective. I could try inkscape I suppose, I did install this before but ImageMagick didn't seem to use it.

User avatar
fmw42
Posts: 24886
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Embedded images in SVG are colour inverted when converted to PNG

Post by fmw42 » 2019-05-20T09:17:45-07:00

Inkscape will only be used if your IM version is 6.7.9-0 or higher.

Post Reply