[reportlab-users] Issue with element superposition when converting SVG to PNG
Philippe Renault
philippe.renault at freenet.de
Mon Jul 12 12:17:41 EDT 2021
Dear reportlab community
I've implemented reportlab in a python script to convert a generated SVG to
PNG to afterwards display it on a display in my smarthome.
Nevertheless, I've been struggling for a long time now to figure out an
issue during the conversion process which I can't resolve.
In the python script I'm using the following basic commands to generate the
PNG:
from svglib.svglib import svg2rlg
from reportlab.graphics import renderPM
from PIL import Image
.
codecs.open(SVG_OUTPUT, "w", encoding="utf-8").write(output)
drawing = svg2rlg(SVG_OUTPUT) # Convert SVG to regular expression
renderPM.drawToFile(drawing, TMP_OUTPUT, fmt="PNG") # Convert SVG to PNG
Attached you will find the input SVG I'm using
(cron_kindle-weather_output.svg) and the output generated by the
renderPM.drawToFile (weatherdata-dg-whz_withMarkups.png). As you can see
there is a superposition of elements in a few places which I don't
understand why this happens. If I use eg. Inkscape to convert to PNG the
figure is ok. Also if I use an online-converter like e.g. SVGTOPNG.com the
output looks fine.
Does anybody have an idea or a lead to why this is happening and how to fix
it?
Thank you very much in advance for support.
Best regards
Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20210712/5efa3192/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Attachment-IssueIllustration.zip
Type: application/x-zip-compressed
Size: 59067 bytes
Desc: not available
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20210712/5efa3192/attachment-0001.bin>
More information about the reportlab-users
mailing list