Python compiled from Python.org source builds the tkinter module as a
built-in module, not an external module, as is the case for the packaged
builds of Debian etc:
>>> Tkinter.tkinter
<module '_tkinter' (built-in)>
This breaks the current algorithm for searching for tkinter symbols,
which loaded the external module .so file to get the symbols.
Try searching in the main program namespace for the tkinter symbols,
before looking for the extermal module .so file.
Thanks to github user ettaka for reporting : see
https://github.com/matplotlib/matplotlib/issues/7428
In the TIFF code saving icc_profile is conditional on tag_v2 being set which doesn't make sense to me. I believe this is merely an indentation typo.
I've been trying to save TIFFs with im.info['icc_profile'] set and compression=raw, but unfortunately this results in TIFFs without ICC color profiles.
With the attached patch TIFFs with said conditions will be saved with the profile set in im.info['icc_profile'].
Note: There are a number of different conditions that need to be met for code to succeed in saving with the profile since it branches between using libtiff and ImageFile._save(..), and the libtiff code does not currently save the ICC color profile.
For instance setting compression=tiff_lzw will result in using libtiff and no profile will be saved.
The data read from the file was unused. The files remained opened and
were never explicitly closed.
Fixes some instances of warnings during tests:
"ResourceWarning: unclosed file ..."
When running python 2.7 with the `-3` flag the following warning occurs
> .../PIL/Image.py:48: DeprecationWarning: classic int division
MAX_IMAGE_PIXELS = int(1024 * 1024 * 1024 / 4 / 3)
Simply changing the 4 and 3 to be floats instead eliminates the warning
and, because the result is cast, the resulting `int` stays the same for
python 2 and 3.