Trim does not remove all edges as expected
Posted: 2013-06-07T04:12:53-07:00
There is a SVG, containing a red grid and a black ellipse. The grid is replaced with transparent, then the image is trimmed. I would expect that only the ellipse is left over. However, also some transparent background at the top and at the left side survives. Why?
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
<g id="svgGrid">
<line fill="none" stroke="#ff0000" x1="32" y1="0" x2="32" y2="512"/>
<line fill="none" stroke="#ff0000" x1="64" y1="0" x2="64" y2="512"/>
<line fill="none" stroke="#ff0000" x1="96" y1="0" x2="96" y2="512"/>
<line fill="none" stroke="#ff0000" x1="128" y1="0" x2="128" y2="512"/>
<line fill="none" stroke="#ff0000" x1="160" y1="0" x2="160" y2="512"/>
<line fill="none" stroke="#ff0000" x1="192" y1="0" x2="192" y2="512"/>
<line fill="none" stroke="#ff0000" x1="224" y1="0" x2="224" y2="512"/>
<line fill="none" stroke="#ff0000" x1="256" y1="0" x2="256" y2="512"/>
<line fill="none" stroke="#ff0000" x1="288" y1="0" x2="288" y2="512"/>
<line fill="none" stroke="#ff0000" x1="320" y1="0" x2="320" y2="512"/>
<line fill="none" stroke="#ff0000" x1="352" y1="0" x2="352" y2="512"/>
<line fill="none" stroke="#ff0000" x1="384" y1="0" x2="384" y2="512"/>
<line fill="none" stroke="#ff0000" x1="416" y1="0" x2="416" y2="512"/>
<line fill="none" stroke="#ff0000" x1="448" y1="0" x2="448" y2="512"/>
<line fill="none" stroke="#ff0000" x1="480" y1="0" x2="480" y2="512"/>
<line fill="none" stroke="#ff0000" x1="0" y1="32" x2="512" y2="32"/>
<line fill="none" stroke="#ff0000" x1="0" y1="64" x2="512" y2="64"/>
<line fill="none" stroke="#ff0000" x1="0" y1="96" x2="512" y2="96"/>
<line fill="none" stroke="#ff0000" x1="0" y1="128" x2="512" y2="128"/>
<line fill="none" stroke="#ff0000" x1="0" y1="160" x2="512" y2="160"/>
<line fill="none" stroke="#ff0000" x1="0" y1="192" x2="512" y2="192"/>
<line fill="none" stroke="#ff0000" x1="0" y1="224" x2="512" y2="224"/>
<line fill="none" stroke="#ff0000" x1="0" y1="256" x2="512" y2="256"/>
<line fill="none" stroke="#ff0000" x1="0" y1="288" x2="512" y2="288"/>
<line fill="none" stroke="#ff0000" x1="0" y1="320" x2="512" y2="320"/>
<line fill="none" stroke="#ff0000" x1="0" y1="352" x2="512" y2="352"/>
<line fill="none" stroke="#ff0000" x1="0" y1="384" x2="512" y2="384"/>
<line fill="none" stroke="#ff0000" x1="0" y1="416" x2="512" y2="416"/>
<line fill="none" stroke="#ff0000" x1="0" y1="448" x2="512" y2="448"/>
<line fill="none" stroke="#ff0000" x1="0" y1="480" x2="512" y2="480"/>
<rect x="0" y="0" fill="none" stroke="#ff0000" width="512" height="512"/>
</g>
<ellipse cx="256.25" cy="352.25" rx="224.25" ry="128.25"/>
</svg>
Code: Select all
convert -background transparent -define png:format=PNG32 -density 720 test-inp.svg -transparent "#ff0000" -trim -repage 0 test-out.png