Page 1 of 1

possible SVG transparency bug IM 6.7.0.10 Q16

Posted: 2011-07-03T17:22:57-07:00
by fmw42

Re: possible SVG transparency bug IM 6.7.0.10 Q16

Posted: 2011-07-06T19:00:47-07:00
by fmw42
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?

Re: possible SVG transparency bug IM 6.7.0.10 Q16

Posted: 2011-07-13T16:45:07-07:00
by anthony
You need to specify default background BEFORE reading the SVG

Code: Select all

convert -background none test.svg  test.png
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!

Re: possible SVG transparency bug IM 6.7.0.10 Q16

Posted: 2011-07-13T16:50:22-07:00
by fmw42
convert -background none test.svg test.png
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.

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.

Re: possible SVG transparency bug IM 6.7.0.10 Q16

Posted: 2011-07-13T17:03:36-07:00
by anthony
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.

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>
Like the spoon in the Matrix, you need to remember... There is no bug!

Re: possible SVG transparency bug IM 6.7.0.10 Q16

Posted: 2011-07-13T17:06:04-07:00
by fmw42
display -background red test.svg
On my system I only see red for the inner and outer boxes, no yellow!

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)

Re: possible SVG transparency bug IM 6.7.0.10 Q16

Posted: 2011-07-13T17:08:14-07:00
by anthony
If you have no yellow, then something is wrong with your SVG rendering.

Try using

Code: Select all

   rsvg-view test.svg
(white background) or

Code: Select all

   convert -background red MSVG:t.svg show:
(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.

Re: possible SVG transparency bug IM 6.7.0.10 Q16

Posted: 2011-07-13T17:11:10-07:00
by fmw42
anthony wrote:If you have no yellow, then something is wrong with your SVG rendering.

Try using

Code: Select all

   rsvg-view test.svg
(white background) or

Code: Select all

   convert -background red MSVG:t.svg show:
(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.

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).

Re: possible SVG transparency bug IM 6.7.0.10 Q16

Posted: 2011-07-13T18:16:52-07:00
by anthony
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