How to install pre-built Pillow wheel with libraqm DLLs on Windows? - python-imaging-library

I tried using the pre-built wheels for Pillow and corresponding libraqm DLL from here:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow
But the following returns False:
from PIL import features
features.check('raqm')
Am I missing anything?
Context: I need libraqm with Pillow to work with complex fonts on images, as shown here.

For anyone who wants RAQM with PIL on Windows, just do pip install Pillow.
Then place the libraqm DLLs in some directory, and then append that directory to environment/shell variable PYTHONPATH. That's it.
Or you could place those DLLs along with your python.exe as commented by #cgohlke.
Just in-case someone wants to know, I'm currently on Python 3.7 (Windows 10) with Pillow 7.2.0 and libraqm-0.7.0.dll

Related

How to install package from github

I would like to use psd-tools package from github.
Given I am not a programer, I found the installation process difficult to follow.
Can someone advice in simple terms how to install and use the psd-tool package.
Apparently, this is all done via the terminal in OSX.
If I understand correctly the package requires python, pip, pillow and packbits to run correctly.
Python is pre installed in OSX. Pip and packbits need to be installed. This where I start to get lost with the installation procedure.
Once the psd-tools package is installed, I am not sure how to call the package to test a psd file.
github psd-tools package
Download Python package for working with Adobe Photoshop PSD files
Installation
pip install psd-tools
Pillow should be installed if you want work with PSD image and layer data: export images to PNG, process them. PIL library should also work.
pip install Pillow
Note
In order to extract images from 32bit PSD files PIL/Pillow must be built with LITTLECMS or LITTLECMS2 support.
psd-tools also has a rudimentary support for Pymaging. Pymaging installation instructions are available in pymaging docs. If you want to use Pymaging instead of Pillow you'll also need packbits library:
pip install packbits
Usage of PSD-Tools and How to use it Read this.
Hope it Helps!

wx.lib.activex fails to import using Enthought Canopy and EPD

import wx.lib.activex fails with the supplied version of wx in Enthought Canopy or EPD on Windows. How can I get the activex container to work with the Enthought Python Distributions?
First of all, it's necessary to install comtypes, which is a dependency not available through the Enthought package manager.
The more serious problem however, is that Enthought seem to have erroneously omitted the two myole4ax.* files which are necessary to use the activex container in wx Python. You can copy these files by downloading the wxPython-src tarball from the project page, and copying the two myole4ax.* files (e.g. from wxPython-src-2.8.12.1\wxPython\wx\lib) to the %python root%\Lib\site-packages\wx\lib folder.

Django OS X Wrong JPEG library version: library is 80, caller expects 62 sorl.thumbnail

Im using sorl.thumbnail for django locally on my mac and have been having trouble with PIL, but today i finally managed to get it installed - was some trouble with libjpeg.
I can now upload and use images - but I cant resize them using sorl.thumbnail.
When i try i get the following error:
Wrong JPEG library version: library is 80, caller expects 62
Does anyone know a good solution for this.
I dont know wether whatever sorl uses requires an earlier version of libjpeg or wether there is some ghost install of something still left behind from all of my tries with various methods.
I have :
PIL 1.1.7
libjpeg 8.
anyone know an approach?
For the benefit of the people from the future who are encountering this error and don't know why, I'd like to post my findings. I hope to give a general understanding of what's gone wrong since the exact commands to fix it may be different on your machine than on my OSX Lion install.
First, since it's easy to get lost in the potential solutions, it's important to understand that the error message is correct when it says Wrong JPEG library version: library is 80, caller expects 62 or some other combination of 62, 70, and 80. These numbers correspond to the different incompatible versions of libjpeg. There are two moving pieces here, the dynamically loaded jpeg library, and the PIL (or Pillow) install. What the error message is saying is that your PIL install was compiled with headers from libjpeg version 6.2, but when it goes to load up the actual shared library, it's being linked to version 8.0.
The fix is to download, build, and install the libjpeg version you want (any will do, though the later versions build easier on OSX Lion):
wget http://www.ijg.org/files/jpegsrc.v8d.tar.gz
tar xzf jpegsrc*
cd jpeg-*
./configure
make
sudo make install
This should drop 2 files of note in '/usr/local/'. Namely /usr/local/lib/libjpeg.8.dylib and /usr/local/include/jpeglib.h. Now we just have to get PIL (or Pillow) to use these two files at install time, and we're home free. I know there's a better way to do this, but the hack (as recommended by the PIL docs) is to edit the setup.py file of the PIL distribution before you install it. You may get away with just setting JPEG_ROOT = libinclude('/usr/local') near the top of setup.py, though further directory manipulation may be necessary elsewhere in the file.
As you fiddle with the paths, you have to make sure PIL does a full rebuild before you test out whether it linked up to the right library or not. I used a command like rm -rf build && python setup.py install to make sure the library was always freshly linked to the current path I was testing.
I'm sorry this is a rambling answer, but it was very disheartening to have tried every other copy & paste solution out there and have none of them work. Hopefully this answer keeps at least a few folks from wasting numerous hours in search of a simplistic solution.
Good Luck!
If you have macports installed, you should do a:
$ sudo port selfupdate
$ sudo port install py27-pil
It's easier than the easy_install method since macports install the right dependencies.
I had a slightly different problem than the OP, but I wanted to share my solution here to help someone in the future.
OS: OSX El Capitan
I installed libjpeg-turbo from the precompiled binaries on their website. However, I did not know that I already had a different version of libjpeg installed on my mac. I was building my c file like this gcc myfile.c -o myfile.out -L /opt/libjpeg-turbo/lib -ljpeg. This got the library from the correct location, but the the linker was getting the included header file jpeglib.h from the pre-installed location. I changed my build command to this: gcc myfile.c -o myfile.out -I/opt/libjpeg-turbo/include/ -L /opt/libjpeg-turbo/lib -ljpeg and it worked. No more library is 80, caller expects 62!
Like a previous answer, I had a slightly different problem than the OP, but I wanted to share my solution here to help someone in the future.
The only thing that worked for me was forcing pip to build pillow from source after installing the dev version of the needed libraries (my code was editing a jpg and adding a label using a custom font). This was on a ARM based embedded device running Ubuntu Linux using Python 3.7.3
apt-get install -y libjpeg-dev libfreetype6-dev
pip3 install pillow --global-option="build_ext" --global-option="--enable-jpeg" --global-option="--enable-freetype"

Installing Python Imaging Library on my iPhone's Python interpreter

I've been learning python for some time now. Recently I needed to install in my Mac the Image module for Python, and after a while I achieve this running a mpkg installer specially for my OS, so far everything was ok and I could run my script.
Now I'm in the needing of running my script in my jailbroken iPhone, which already has a python interpreter, and I need to install this Image module again but this time on my phone.
Is there another way to do it? How can I do it manually?
I found out how
I downloaded the PIL 1.1.7 source from http://www.pythonware.com/products/pil/ and untared the Imaging-1.1.7.tar.gz file, then I made the following commands:
cd Imaging-1.1.7/
python setup.py install
You can also follow the instructions on the README file in Imaging-1.1.7/ for building the package on your own.
that's it

How to install PIL in system library using homebrew?

In a new SnowLeopard install, I'd like to use homebrew to install PIL. However the recipe installs PIL under cellar instead of in /Library/Python/2.6/site-packages. Is there a way to change the install directory?
Instead of installing pip and another PIL, you can just make a symlink
brew install pil
ln -s /usr/local/Cellar/pil/1.1.7/lib/python2.7/site-packages/PIL /Library/Python/2.7/site-packages/PIL
Tested on Lion, on Snow Leopard, you may need to change paths to use /python2.6 /Python/2.6.
It seems that Pillow replaced PIL in homebrew. The new command is:
brew install Homebrew/python/pillow
Since there seems to be no "accepted" way of installing homebrew eggs into the system site-packages, here is what I ended up doing:
% brew install pil
% easy_install pip
% pip install pil
The homebrew install grabs and installs all of PIL's dependencies (especially jpeg). The later easy_install then uses them when compiling PIL for the system site-packages. Freetype support doesn't show up in the "easy-installed" version, but that's fine for my purposes.
As my initial goal was to provide a simple way for a web designer to build a django development environment, having an unused homebrew PIL installed is not really a problem.
Hope this helps someone. Still hoping there's a better answer out there.
As #BarnabasSzabolcs mentioned, newer versions named pillow.
an alternative to brew install Homebrew/python/pillow is pip install pillow. You may need to add sudo, depends on your python environment permissions.
p.s.
that answer could be fit better as a comment, 14 credits to go...