python - How to save an Image locally using PIL -


i making program builds thumbnail based on user input, , running problems saving image. used c++ can save image, seems python not support this.

this code right now:

def combine(self):     img = image.new("rgba", (top.width,top.height+mid.height+mid.height),(255,255,255))     img.paste(top, (0,0))     img.paste(mid, (0,top.height))     img.paste(bot, (0,top.height+mid.height))     img.show()     img.save("thumbnail.png", "png") 

the error shows when run :

traceback (most recent call last):    file "texttothumbnail.py", line 4, in <module>     class thumbnail(object):   file "texttothumbnail.py", line 461, in thumbnail     img.save("thumbnail.png", "png") nameerror: name 'img' not defined 

what going on? preferably want able save image locally, since program running on multiple setups different pathways program.


Comments

Popular posts from this blog

javascript - Knockout pushing observable and computed data to an observable array -

'hasOwnProperty' in javascript -

Trouble making a JSON string -