You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you remove JPEG metadata, the quality and size of the image change
The thing is that your code does not take into account that Pillow saves files with default quality settings.
You need to take this into account in your code, because otherwise JPEG images lose quality, and if they were previously compressed, they increase in size (since they acquire the default quality that Pillow sets).
You need to do something with the "quality" and "subsampling" parameters at the .save() stage.
However, I do not yet understand how to fix this, since the original JPEG files do not have metadata about quality and subsampling, and the "keep" value does not work because Pillow sets format = None when creating a new image, which leads to an error.
If you set the values "quality" = 100 and "subsampling" = 0, then the created images will weigh almost as much as PNG images, although compression methods that reduce their weight could have been applied to the original JPEG images earlier.
When you remove JPEG metadata, the quality and size of the image change
The thing is that your code does not take into account that Pillow saves files with default quality settings.
You need to take this into account in your code, because otherwise JPEG images lose quality, and if they were previously compressed, they increase in size (since they acquire the default quality that Pillow sets).
You need to do something with the "quality" and "subsampling" parameters at the .save() stage.
However, I do not yet understand how to fix this, since the original JPEG files do not have metadata about quality and subsampling, and the "keep" value does not work because Pillow sets format = None when creating a new image, which leads to an error.
If you set the values "quality" = 100 and "subsampling" = 0, then the created images will weigh almost as much as PNG images, although compression methods that reduce their weight could have been applied to the original JPEG images earlier.
This problem needs to be solved, because otherwise the library spoils the quality and volume of the original JPEG files (and possibly other formats).
The text was updated successfully, but these errors were encountered: