Q:

Find which libjpeg is being used by PIL / PILLOW

I am getting an error where reading the same lena.jpg file on two different computers yeilds two different checksums. 
Even weirder is that when I run md5sum lena.jpg I get the same md5 sum on both machines, so the files are identical.  
Furthermore, when I load a png instead of a jpeg the numbers seem to match up.  This leads me to believe there is a disconnect between Pillow on the two different machines, or at least the library they are using to read jpeg files.   
Is there any way to check which version of libjpeg is being used by Pillow (from within Python preferably)?  
Both of the computers are Ubuntu, although one is 12.04, and one is 14.04 (I also tested it on a mac and got the same values as the 14.04 box)

A:

First, locate the PIL egg that your Python installation is using:
>>> import PIL
>>> PIL.__path__
['/usr/local/python/2.7.3/lib/python2.7/site-packages/PIL']

Then locate _imaging.so in that directory and use ldd (Linux) or otool -L (OS X) to find out what version of libjpeg it has been linked against:
Linux
$ ldd /usr/local/python/2.7.3/lib/python2.7/site-packages/PIL/_imaging.so
    linux-gate.so.1 =>  (0x00641000)
    libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00f00000)
    libz.so.1 => /lib/libz.so.1 (0x006f4000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00fad000)
    libc.so.6 => /lib/libc.so.6 (0x0021b000)
    /lib/ld-linux.so.2 (0x0067e000)

Mac OS X
$ otool -L /Users/lukas/src/pillow-env/lib/python2.7/site-packages/PIL/_imaging.so
/Users/lukas/src/pillow-env/lib/python2.7/site-packages/PIL/_imaging.so:
    /usr/local/lib/libjpeg.8.dylib (compatibility version 13.0.0, current version 13.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/local/lib/libtiff.5.dylib (compatibility version 8.0.0, current version 8.0.0)
    /usr/lib/libSystem. B.dylib (compatibility version 1.0.0, current version 159.1.0)

