Python Forum
Simple longline function - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/Forum-General)
+--- Forum: Code Review (https://python-forum.io/Forum-Code-Review)
+--- Thread: Simple longline function (/Thread-Simple-longline-function)



Simple longline function - programerAnel - Jan-21-2021

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