Math BKweb
unread,May 18, 2013, 4:47:45 AM5/18/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to kivy-...@googlegroups.com
Hi Kivy Users and Developpers
I managed to get png picture size with this :
def get_png_size(png_path):
curdir = dirname(__file__)+'/'
size = [0,0]
f = open( curdir + png_path)
if f:
f.seek(12) # debut du marqueur chaine contenant : ihdr
ihdr = f.read(4)
if ihdr == 'IHDR':
sWidth = f.read(4)
size[0] = int(sWidth.encode('hex'), 16)
sHeight = f.read(4)
size[1] = int(sHeight.encode('hex'),16)
else:
print "IHDR tag not found, wrong png format"
f.close();
return size
Is this some kind of overbombing ? I am new to Python, Kivy and mobile devices. Sort of caveman ;)
How can I make it in a cleaner way ?
Thanks for answers
PS: Kivy is great