Skip to content

Commit

Permalink
Some functions to be used in converting images
Browse files Browse the repository at this point in the history
  • Loading branch information
dcunhas committed Jun 15, 2016
1 parent 7a8f72c commit c4b608d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/*
19 changes: 19 additions & 0 deletions convert_images.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from wand.image import Image
import StringIO

def convertSVGtoPNG(filepath):
#Convert copy of image to new format
with Image(file).clone() as img:
img.format = 'png'
img.save(filename='C:/Users/Sandeep/test.png')


def stringToSVGString(str):
height = 386
width = 241

return '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' \
'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">' \
'<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" ' \
'xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" xml:space="preserve" height=%i ' \
' width=%i>%s</svg>' %(height, width, str)

0 comments on commit c4b608d

Please sign in to comment.