Last active
August 29, 2015 13:56
-
-
Save amalgamatedclyde/8916255 to your computer and use it in GitHub Desktop.
this works on linux but not android.
This file contains hidden or 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
def change_image(instance, photo): | |
"""open selected image, resize and blit into texture""" | |
global currentTexture | |
##try: | |
img = PILImage.open(instance.selection[0]) | |
##print img | |
currentTexture = Texture.create(size= (180,240)) | |
img2 = img.resize((180,240), PILImage.BICUBIC) | |
buf = img2.tostring() | |
currentTexture.blit_buffer(buf, colorfmt='rgb', bufferfmt='ubyte') | |
currentTexture.flip_vertical() | |
texture1 = currentTexture.get_region(0,0,180,180) | |
photo.texture = texture1 | |
#except: pass | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment