Python Forum

Full Version: Simple longline function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Please guys don't tell me that I must use the save to path and load from path

def reduce_image_size(dmy):
    with open('MyTempImage.jpg', 'wb') as f:
        f.write(dmy)
    f.close()
    image =Image.open('MyTempImage.jpg')
    image.save('MyTempImageOUT.jpg',quality=20,optimize=True)
    with open('MyTempImageOUT.jpg', "rb") as rawimg:
        return rawimg