Page 1 of 1

Embedded images in SVG are colour inverted when converted to PNG

Posted: 2019-05-17T02:14:28-07:00
by hairykid
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

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

Posted: 2019-05-17T09:13:29-07:00
by fmw42
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.

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

Posted: 2019-05-17T09:25:40-07:00
by fmw42
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.

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

Posted: 2019-05-20T01:47:47-07:00
by hairykid
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.

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

Posted: 2019-05-20T09:17:45-07:00
by fmw42
Inkscape will only be used if your IM version is 6.7.9-0 or higher.

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

Posted: 2019-05-21T04:08:54-07:00
by hairykid
I have tried installing inkscape but the issue persists unfortunately.

Here are 2 copied of the same logo, one is larger in filesize than the other, as far as I can tell that is the only difference.

https://ufile.io/cg6dwtff - This one inverts in colour (838KB)
https://ufile.io/prozc91z - This one works fine (253KB)

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

Posted: 2019-05-21T09:13:59-07:00
by fmw42
Please provide your SVG files and your exact command lines and IM version and platform. Also what do you get from

Code: Select all

convert -list format
for the line starting with SVG

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

Posted: 2019-05-24T02:20:46-07:00
by hairykid
OS: Ubuntu 18.10
Version: ImageMagick 7.0.8-45

convert -list format outputs -
SVG rw+ Scalable Vector Graphics (XML 2.9.4)

Command being run - convert msvg:/var/www/mydomain.co.uk/sites/default/files/tmp/preview-402545132-zzD8AN png:/var/www/mydomain.co.uk/sites/default/files/preview/177390993-1558689408.png

177390993-1558689408 - https://ufile.io/896dbra2
preview-402545132-zzD8AN - https://ufile.io/r57mvuwt

Thanks

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

Posted: 2019-05-24T08:04:20-07:00
by fmw42
convert msvg:...
This is forcing the using of the internal MSVG/XML renderer. If you want to use inkscape and it is on your system and your IM version is current enough, then remove the msvg: from in front of your SVG file specification.

When I run it using Inkscape with ImageMagick, I get a "linked image is not found" graphic in the output png along with the 100.

Code: Select all

convert preview-402545132-zzd8an.svg preview-402545132-zzd8an.png
with msvg, nothing shows but the 100.

Code: Select all

convert msvg:preview-402545132-zzd8an.svg preview-402545132-zzd8an.png
Same with rsvg, nothing shows but the 100.

I do not know if any of these tools can access https: links to images imbedded in SVG files. I am not an expert on SVG. Perhaps one of the other IM users can comment further.

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

Posted: 2019-05-28T23:41:01-07:00
by hairykid
Ok so are we saying that Inkscape doesn't even allow this type of conversion to take place?