Embedded images in SVG are colour inverted when converted to PNG
Embedded images in SVG are colour inverted when converted to PNG
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
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
- fmw42
- Posts: 25562
- 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
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:
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.
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.
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
Code: Select all
magick original.svg orig.png
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.
- fmw42
- Posts: 25562
- 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
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
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.
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.
- fmw42
- Posts: 25562
- 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
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
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)
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)
- fmw42
- Posts: 25562
- 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
Please provide your SVG files and your exact command lines and IM version and platform. Also what do you get from
for the line starting with SVG
Code: Select all
convert -list format
Re: Embedded images in SVG are colour inverted when converted to PNG
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
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
- fmw42
- Posts: 25562
- 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
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.convert msvg:...
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
Code: Select all
convert msvg:preview-402545132-zzd8an.svg preview-402545132-zzd8an.png
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
Ok so are we saying that Inkscape doesn't even allow this type of conversion to take place?