deeplook / svglib

Read SVG files and convert them to other formats.
GNU Lesser General Public License v3.0
307 stars 79 forks source link

make xlink_href_target method create PIL image instead of temporary file #394

Closed wgundamj44 closed 7 months ago

wgundamj44 commented 7 months ago

Described in https://github.com/deeplook/svglib/issues/393

The current implementation creates a temporary file and pass its path all the way down to reportlab for render. It's hard to find a place to unlink the temporary file because it might be outside of svglib's reach when reportlab is done with the file.

This PR tries to pass PIL Image to reportlab, since reportlab seems to support both file path and Image.

deeplook commented 7 months ago

Thanks! Could you also please add a test case?

claudep commented 7 months ago

I think that part of the code is already covered by test_samples.TestOtherFiles.test_png_in_svg. @deeplook, did you have another test in mind?

deeplook commented 7 months ago

@claudep True, that should do it! Fine then with me.