Skip to content

Instantly share code, notes, and snippets.

@DocMinus
Created January 20, 2023 16:06
Show Gist options
  • Save DocMinus/026ed8c845f9ad3c7dcf3df286038714 to your computer and use it in GitHub Desktop.
Save DocMinus/026ed8c845f9ad3c7dcf3df286038714 to your computer and use it in GitHub Desktop.
Python SVG images in memory without using temp files
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DocMinus
Copy link
Author

Especially in context of building GUIs this comes in handy.

@brifordwylie
Copy link

Wow, thank you SO much, spent half a day trying to figure this out. It would seem like this would be easy (see rdkit/rdkit#7497) but shrug.. please keep me updated if you find a better/simpler solution. Thanks again for posting this gist!

@DocMinus
Copy link
Author

DocMinus commented Dec 29, 2024

Wow, thank you SO much, spent half a day trying to figure this out. It would seem like this would be easy (see rdkit/rdkit#7497) but shrug.. please keep me updated if you find a better/simpler solution. Thanks again for posting this gist!

Glad it helped (and that someone actually found this!).
This is basically still what I use, don't think it gets much simpler, by the time you remove all the comments there aren't many lines of code and being used as a function you will prolly "never really see this" in the end :D

@brifordwylie
Copy link

brifordwylie commented Jan 8, 2025

Screenshot 2025-01-08 at 8 46 59 AM

Just for fun, put up a prototype app: compound-explorer

@DocMinus
Copy link
Author

DocMinus commented Jan 8, 2025

Just for fun, put up a prototype app: compound-explorer
Nice, good job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment