Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python PIL jpeg quality

I use python to save jpegs in a smaller quality

im = Image.open(file)
im.save(cached_file, quality=80, optimize=True, progressive=True)

In some images however, the file size of the new image is larger than the original's. How can this happen?

like image 447
Thomas Avatar asked Apr 25 '12 15:04

Thomas


People also ask

Does PIL support JPEG?

PIL is a free library that adds image processing capabilities to your Python interpreter, supporting a range of image file formats such as PPM, PNG, JPEG, GIF, TIFF and BMP.

What format is a PIL image?

By default, the image data will be saved in PNG format. With a bitmap format of “bmp”, image data will be saved in BMP format instead. New in version 8.3. 0.


1 Answers

Is it possible that the original image was saved with quality < 80? So, you are basically using more space to save artifacts of the reconstruction?

like image 76
user1245262 Avatar answered Oct 12 '22 04:10

user1245262