I am making a program that builds a thumbnail based on user input, and I am running into problems actually saving the image. I am used to C++ where you can simply save the image, it seems that python does not support this.
This is my 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 that shows up when I run it is :
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' is not defined
What is going on? Preferably I just want to be able to save the image locally, since this program will be running on multiple setups with different pathways to the program.