I got a requirement to compress any uploaded images less than 500kb in file size, I have searched on google and all I can see is:

 >>> foo = foo.resize((160,300),Image.ANTIALIAS)
 >>> foo.save("path\\to\\save\\image_scaled.jpg",quality=95)

If I go with this approach I will have to check if the image is less than 500kb after compress, if not then go for lower quality and size.

Is there a better way to do it?

Edit
Report