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

Add more example and pip install commands to README.md #391

Open
dinhanhx opened this issue Nov 20, 2023 · 4 comments
Open

Add more example and pip install commands to README.md #391

dinhanhx opened this issue Nov 20, 2023 · 4 comments

Comments

@dinhanhx
Copy link

For example section, the following code can be added to demonstrate how to convert a svg file to a Pillow Image object

Example svg file: https://upload.wikimedia.org/wikipedia/commons/4/4f/SVG_Logo.svg

from svglib.svglib import svg2rlg
from reportlab.graphics import renderPM
from PIL import Image
import io

drawing = svg2rlg("SVG_Logo.svg")
place_holder = io.BytesIO()
renderPM.drawToFile(drawing, place_holder, fmt="PNG")

image = Image.open(place_holder)
image.show()

For pip install section, I believe it would be better if this was added

pip install svglib rlPyCairo reportlab

So other people can have quick installation without fixing missing dependencies.

Copy link

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

@claudep
Copy link
Collaborator

claudep commented Nov 20, 2023

Thanks for this suggestion, would you like to create a pull request with this snippet?

@dinhanhx
Copy link
Author

I believe it would be better if you do that because you might want to edit the suggested examples.

@deeplook
Copy link
Owner

We can easily adjust it after you add a contribution to this package and your own list. ;-)

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

3 participants