Python Forum
Simple longline function - Printable Version

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



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