possible SVG transparency bug IM 6.7.0.10 Q16
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible SVG transparency bug IM 6.7.0.10 Q16
IM 6.7.0.10 Q16 Mac OSX Tiger with RSVG
This svg file (taken from the SVG docs page (http://www.w3.org/TR/SVG/shapes.html#RectElement) does not seem to render -fill correctly in IM
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="12cm" height="4cm" viewBox="0 0 1200 400"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<desc>Example rect01 - rectangle with sharp corners</desc>
<!-- Show outline of canvas using 'rect' element -->
<rect x="1" y="1" width="1198" height="398"
fill="none" stroke="blue" stroke-width="2"/>
<rect x="400" y="100" width="400" height="200"
fill="yellow" stroke="navy" stroke-width="10" />
</svg>
When I do:
convert test.svg test.png
or
convert test.svg -channel rgba -alpha on test.png
or
convert test.svg -background none test.png
or
convert test.svg PNG32:test.png
or
convert test.svg -define png:color-type=6 test.png
or
convert test.svg test.gif
or
convert test.svg test.tif
I get a white fill rather than transparent and yellow.
Is there something wrong with the file? Am I doing something wrong? Can anyone else confirm this? Or is it just my Mac Tiger system?
This svg file (taken from the SVG docs page (http://www.w3.org/TR/SVG/shapes.html#RectElement) does not seem to render -fill correctly in IM
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="12cm" height="4cm" viewBox="0 0 1200 400"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<desc>Example rect01 - rectangle with sharp corners</desc>
<!-- Show outline of canvas using 'rect' element -->
<rect x="1" y="1" width="1198" height="398"
fill="none" stroke="blue" stroke-width="2"/>
<rect x="400" y="100" width="400" height="200"
fill="yellow" stroke="navy" stroke-width="10" />
</svg>
When I do:
convert test.svg test.png
or
convert test.svg -channel rgba -alpha on test.png
or
convert test.svg -background none test.png
or
convert test.svg PNG32:test.png
or
convert test.svg -define png:color-type=6 test.png
or
convert test.svg test.gif
or
convert test.svg test.tif
I get a white fill rather than transparent and yellow.
Is there something wrong with the file? Am I doing something wrong? Can anyone else confirm this? Or is it just my Mac Tiger system?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: possible SVG transparency bug IM 6.7.0.10 Q16
You need to specify default background BEFORE reading the SVG
Otherwise you will have a white background on read! and the background setting done afterwards does nothing.
See...
http://www.imagemagick.org/Usage/draw/#svg_settings
The fill however remains correct! It is transparent... to the canvas background!
If you swap the two rectangle draws in the SVG you will see that, as you get the same result. with the yellow rectangle (now drawn first) still visible as the new rectangle was transparent.
The robed figure, waved his hand.. This is not the bug you are looking for!
Code: Select all
convert -background none test.svg test.png
See...
http://www.imagemagick.org/Usage/draw/#svg_settings
The fill however remains correct! It is transparent... to the canvas background!
If you swap the two rectangle draws in the SVG you will see that, as you get the same result. with the yellow rectangle (now drawn first) still visible as the new rectangle was transparent.
The robed figure, waved his hand.. This is not the bug you are looking for!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible SVG transparency bug IM 6.7.0.10 Q16
With this, I get transparent fill for both the outer and inner box in test.png as seen by Mac PREVIEW and IM display. The inner box should be yellow! Are you getting a yellow inner box? Same if I save as gif or tif.convert -background none test.svg test.png
when I do:
display test.svg
I get both boxes filled with white.
When I drop the test.svg file on my browser (Safari), I see the proper yellow inner box fill and the transparent outer box with white from the page background.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: possible SVG transparency bug IM 6.7.0.10 Q16
If I use
display -background red test.svg
I get a yellow filled outlined box and a blue border. with a red background behind the transparent fill!
This SVG moves the border inward a so you have a inside and outside to that blue rectangle.
Like the spoon in the Matrix, you need to remember... There is no bug!
display -background red test.svg
I get a yellow filled outlined box and a blue border. with a red background behind the transparent fill!
This SVG moves the border inward a so you have a inside and outside to that blue rectangle.
Code: Select all
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="12cm" height="4cm" viewBox="0 0 1200 400"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<desc>Example rect01 - rectangle with sharp corners</desc>
<!-- Show outline of canvas using 'rect' element -->
<rect x="20" y="20" width="1160" height="360"
fill="none" stroke="blue" stroke-width="2"/>
<rect x="400" y="100" width="400" height="200"
fill="yellow" stroke="navy" stroke-width="10" />
</svg>
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible SVG transparency bug IM 6.7.0.10 Q16
On my system I only see red for the inner and outer boxes, no yellow!display -background red test.svg
Do you get an error when you do:
display -background none test.svg
display: color is not known to server `none': Resource temporarily unavailable @ error/xwindow.c/XGetPixelPacket/3073.
convert -list format
...
SVG SVG rw+ Scalable Vector Graphics (RSVG 2.32.1)
SVGZ SVG rw+ Compressed Scalable Vector Graphics (RSVG 2.32.1)
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: possible SVG transparency bug IM 6.7.0.10 Q16
If you have no yellow, then something is wrong with your SVG rendering.
Try using
(white background) or
(red background)
All these produce the expected results.
Hmmm let me update to latest IM v6 and IM v7 alpha (now the main branch of the SVN repository) and test again.
Try using
Code: Select all
rsvg-view test.svg
Code: Select all
convert -background red MSVG:t.svg show:
All these produce the expected results.
Hmmm let me update to latest IM v6 and IM v7 alpha (now the main branch of the SVN repository) and test again.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible SVG transparency bug IM 6.7.0.10 Q16
anthony wrote:If you have no yellow, then something is wrong with your SVG rendering.
Try using(white background) orCode: Select all
rsvg-view test.svg
(red background)Code: Select all
convert -background red MSVG:t.svg show:
All these produce the expected results.
Hmmm let me update to latest IM v6 and IM v7 alpha (now the main branch of the SVN repository) and test again.
The first works fine for me.
rsvg-view test.svg
The second does not work because I cannot get show: to work at all. See the show: error bug report at viewtopic.php?f=3&t=19067.
convert -background red MSVG:test.svg show:
This however, does work fine:
convert -background none MSVG:test.svg test3.png
So it appears to be related to the version of RSVG vs MSVG!
Something is in error with my version of RSVG (RSVG 2.32.1).
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: possible SVG transparency bug IM 6.7.0.10 Q16
I see no faults for IM v6.7.1 nor for IM 7.0.0 alpha
MSVG or RSVG (the rsvg library is unchanged) RPM version v2.32.0-3.fc14
MSVG or RSVG (the rsvg library is unchanged) RPM version v2.32.0-3.fc14
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/