from pil import Image def newImg(): img = Image.new('RGB', (100, 100)) img.putpixel((30, 60), (155, 155, 55)) img.save(r'C:UserslenovoDesktopsqr.png') return img newImg()