Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svglib doesn't remove temporary files properly? #393

Closed
wgundamj44 opened this issue Dec 15, 2023 · 5 comments
Closed

svglib doesn't remove temporary files properly? #393

wgundamj44 opened this issue Dec 15, 2023 · 5 comments

Comments

@wgundamj44
Copy link
Contributor

When using svglib on svgs that have images, we found the disk size keeps growing up. The culprit is the temporary files created by this method xlink_href_target.

This line https://github.com/deeplook/svglib/blob/main/svglib/svglib.py#L701 mentioned the temporary files needs to be removed later, but I didn't find the place where they got removed.

Did I miss something or the removal is really missing?

Copy link

Thank you for raising your first issue! Your help to improve svglib is much appreciated!

@claudep
Copy link
Collaborator

claudep commented Dec 15, 2023

It's totally possible the file is never removed. Any implementation suggestion is welcome.

@wgundamj44
Copy link
Contributor Author

I think instead of creating a temporary file here https://github.com/deeplook/svglib/blob/main/svglib/svglib.py#L695, maybe it can create a PIL.Image instead. From what I read, reportlab.graphcis.renderPDF.drawImage can accept PIL.Image in new versions.

@claudep
Copy link
Collaborator

claudep commented Dec 15, 2023

Any pull request is welcome!

@claudep
Copy link
Collaborator

claudep commented Dec 16, 2023

Fixed by 484d366

@claudep claudep closed this as completed Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants