Last active
September 16, 2022 18:30
-
-
Save jj-github-jj/959dacc512d426dbd52e1d2ca9f8ebc2 to your computer and use it in GitHub Desktop.
svg utili
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#!{sys.executable} -m pip install svgutils --user\n", | |
"# overlay svg images from files called stacking\n", | |
"\n", | |
"from svgutils.transform import fromfile\n", | |
"from svgutils.templates import VerticalLayout, ColumnLayout\n", | |
"\n", | |
"\n", | |
"layout = ColumnLayout(5)\n", | |
"\n", | |
"for i in range(10):\n", | |
" svg = fromfile(svglist[i])\n", | |
" layout.add_figure(svg)\n", | |
"\n", | |
"layout.save(r\"c:\\temp\\stack_svg.svg\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# didnt quite work\n", | |
"\n", | |
"from svgimgutils import SVGImgUtils\n", | |
"f=r\"C:\\temp\\fs.svg\"\n", | |
"base_template = SVGImgUtils.fromfile(f)\n", | |
"base_template = SVGImgUtils.fromfile(r'c:\\temp\\fs.svg')\n", | |
"# Append SVG images onto base template\n", | |
"# base_template.append(pants)\n", | |
"# # Save new merged SVG image\n", | |
"# base_template.save('Images/merged.svg')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3.9.5 64-bit ('3.9.5')", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"name": "python", | |
"version": "3.9.5" | |
}, | |
"orig_nbformat": 4, | |
"vscode": { | |
"interpreter": { | |
"hash": "e936c08af75c116cb3287b462d25e7be8037b3435bb9d3712ce8da9df27974e5" | |
} | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment