Click here to Skip to main content
14,975,411 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I have to convert svg files into png or gif but I dont know if it's even possible, do anyone know a way thi achive this? the reason I need to convert the svg file to png or gif is because I want to upload it but the site dosnt support svg's.

Im using python 3.5 on windows 7

I doubt the source would provide improved answeres but if you think you need the code I can post a link to pastebin or something.

What I have tried:

Ive tryed cairosvg but I just got a bunch of errors so I might be doing it all wrong, the documentation were insufficent for me.
I also checked pycairo but I didnt understand the installation procedure...
Posted
Updated 15-Feb-16 1:53am
v3
Comments
Kornfeld Eliyahu Peter 15-Feb-16 8:00am
   
1. Should it be a one-time convert?
2. Show your code and errors...

1 solution

Your problems are related to the fact that you are using Windows. While there are multiple libraries and tools to perform the conversion with Linux (including Python wrappers), these may be not available for Windows or difficult to setup.

The simplest solution would be calling a command line tool from within Python (os.system or subprocess.call). One candidate providing ready to use Windows executables would be ImageMagick: Install from Binary Distribution[^]. You can also use the Windows version of Inkscape[^] which provides command line options for conversions without starting the GUI.
   
Comments
Member 12328160 15-Feb-16 8:27am
   
Thx, might have walked into something I cant complete but I will try. I will see if I can get somewhere with your suggestions =D.
Member 12328160 15-Feb-16 13:17pm
   
Since ive got the same suggestion from multiple forums Im certain this is the answere thank you. (Had to use source criticism).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900