Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
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?
The red lines will not necessarily be 100% opaque red on a 100% transparent background. The edges may transition. Why this only affects two sides of your image is chance. Change your density and this will change.
So setting #ff0000 to transparent is not enough. You need to deal with the entire spectrum of semi-transparent red (#ff0000??).
There is no transition to be seen. These are sharp lines. Also in the final test-2.png there is only the ellipse with transparency around it.
UPDATE
I also played with -density and -fuzz. However, no success.
I finally found the reason, why the image is not trimmed as expected. There is one single faint horizontal line in the 5th pixel row from the top, which I had not seen before. I do not know enough about image processing and ImageMagick. So I cannot say, why this single row out of a 16x16 grid with 10 pixel wide lines appears at all.
mgs wrote:There is one single faint horizontal line in the 5th pixel row from the top, which I had not seen before. I do not know enough about image processing and ImageMagick. So I cannot say, why this single row out of a 16x16 grid with 10 pixel wide lines appears at all.
It appears to be a bug in rendering svg rectangles.
I think we have this problem cornered so I created a new topic on the Bugs forum. If you need further help with this bug, post your IM version, platform, and any information you think is relevant there. If you need help with a work-around, feel free to continue this topic.
Thanks a lot for the answer. Just for reference, my environment was Windows 8, IM 6.8.5-9 2013-05-30 Q16.
If somebody has another way to remove those gridlines, I would like to hear it. However, this would only be out of curiosity and for learning IM. I already solved my problem by doing some preprocessing on the SVG (reading and writing it as XML).