Skip to content Skip to sidebar Skip to footer

Why Does The Size Of My Image Decrease When I Add A Comment To An Image?

I tried to add a comment to my image and it decreased the filesize. I have three images all have different file sizes and different user comment EXIF data .The image without the co

Solution 1:

When you save an image (im.save(filename, 'jpeg', exif=exif_bytes)) using PIL library there is a default quality that you use. This default is 75 (which means - if your original image is in higher quality - during the saving - the quality of the image will decrease, and also the size of the image.

You can change the quality by using quality=X (X = 1->95, You should avoid any number above 95):

im.save(filename, 'jpeg', exif=exif_bytes, quality=95)

Note that it might create an image with higher size than your original image's size.

There is a question on stack regarding the original quality of image, you can check more here: Determining JPG quality in Python (PIL)


Post a Comment for "Why Does The Size Of My Image Decrease When I Add A Comment To An Image?"