Find which libjpeg is used by PIL / PILLOW

I get an error when you read one lena.jpg file on two different computers, setting up two different checksums.

Even stranger, when I run md5sum lena.jpg I get the same amount of md5 on both machines, so the files are identical.

Also, when I load png instead of jpeg, the numbers seem to match. This makes me think that there is a gap between Pillow on two different machines, or at least the library that they use to read jpeg files.

Is there a way to check which version of libjpeg is used by Pillow (preferably from Python)?

Both computers are Ubuntu, although one of them is 12.04, and one is 14.04 (I also tested it on mac and got the same values ​​as 14.04)

+2
source share
2 answers

First, find the PIL egg that your Python installation uses:

>>> import PIL >>> PIL.__path__ ['/usr/local/python/2.7.3/lib/python2.7/site-packages/PIL'] 

Then find _imaging.so in this directory and use ldd (Linux) or otool -L (OS X) to find out which version of libjpeg it was linked to:

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) 
+5
source

Try the following:

 ldd path/to/your/PIL/_*.so 

If you are using virtualenv, try finding PIL on VIRTUALENV_HOME, usually this is under

 ~/.virtualenvs/$VIRTUAL_ENV/lib/python2.7/site-packages/PIL 

If you are using ubuntu packages, use dpkg to find the installation location of your pillow / PIL.

0
source

Source: https://habr.com/ru/post/970486/


All Articles