Let cat.png be a PNG image.
ls -l cat.png
-rw-r--r-- 1 user user 138198 29 Aug 2012 cat.png
Its size in bytes is 138198. Then, from Python:
from PIL import Image
im = Image.open('cat.png')
im.save('test-cat.png')
And:
ls -l
-rw-r--r-- 1 user user 138198 29 Aug 2012 cat.png
-rw-r--r-- 1 user user 134105 10 Mar 17:18 test-cat.png
The size of the file is smaller.
Now, I am aware [1] that PIL strips out some metadata (e.g.: 'info'). However, if I use the method from [1] to preserve 'info', the result is:
ls -l
-rw-r--r-- 1 user user 135026 10 Mar 17:23 test-cat-with-info.png
What am I missing? Or, better, what is the file created by PIL missing?
Cheers
Refs
[1] http://blog.modp.com/2007/08/python-pil-and-png-metadata-take-2.html
Cat pic
[2] http://exmoorpet.com/wp-content/uploads/2012/08/cat.png ;)