Commit Graph

31 Commits

Author SHA1 Message Date
Jon Dufresne
d244fbb299 Remove unnecessary calls to dict.keys()
iter(dict) is equivalent to iter(dict.keys()), so simply act on the dict
instead of adding the extra call.

Inspired by Lennart Regebro's PyCon 2017 presentation "Prehistoric
Patterns in Python". Available at:

https://www.youtube.com/watch?v=V5-JH23Vk0I
2017-05-28 09:55:38 -07:00
Andrew Murray
58b5c9187d Replaced absolute PIL imports with relative imports (#2349) 2017-01-17 13:22:18 +00:00
hugovk
adfda1a5a4 Python 3 compatibility 2016-11-30 16:50:44 +02:00
hugovk
880464f46c Only save relevant sizes 2016-11-30 16:41:43 +02:00
hugovk
b341898c7f Allow 256x256 sizes 2016-11-30 16:00:14 +02:00
hugovk
43fc9c9b59 flake8 2016-11-30 14:51:30 +02:00
hugovk
cc89d95f02 Fix saving 256x256 icons 2016-11-30 14:50:53 +02:00
Jon Dufresne
dbe9f85c7d Drop support for Python 2.6
* Drop unittest2 requirement
* Use set literals
* Use dict/set comprehension
* Use str.format() automatic numbering
2016-11-22 04:23:55 -08:00
Andrew Murray
895ab20438 Updated redirect URL 2016-02-22 18:38:04 +11:00
Andrew Murray
a7c7aa171d Updated redirected URLs 2016-02-11 18:51:36 +11:00
Andrew Murray
0e1eb970e5 Updated URLs 2015-12-29 00:04:39 +11:00
Andrew Murray
c6b13d294f Flake8 fixes 2015-08-25 22:27:18 +10:00
Andrew Murray
fa73879d19 Changed register calls to use format property 2015-07-04 23:29:58 +10:00
Hugo
022cebd723 Merge pull request #1232 from wiredfool/ico-bigendian
Ico files are little endian, ref #1204
2015-05-29 18:28:59 +03:00
Andrew Murray
3c7e37d2d7 Replaced old-style classes 2015-05-27 00:07:21 +10:00
Eric Soroos
93461e6faa Ico files are little endian, ref #1204 2015-05-13 03:05:45 -07:00
Karim Bahgat
740ab40c6d Keep user-specified ordering of icon sizes
Some consumers of icon files such as py2exe care about the order that icon sizes are added, so the user should be fully in charge of this, instead of force sorting them.
2015-04-14 20:17:57 +02:00
wiredfool
8ebdc5b64d Comment typo [ci skip] 2015-01-28 20:23:15 -08:00
homm
43d5d06ce4 rename Image.ANTIALIAS to Image.LANCZOS 2014-11-28 01:41:56 +03:00
Herb
79c7c7a01a add tests and docs 2014-11-08 14:49:50 +08:00
Herb
b38c8e0df2 add ico save support 2014-11-08 03:01:46 +08:00
hugovk
8de95676e0 flake8 2014-08-26 16:47:10 +03:00
wiredfool
36323d1140 Make ICO files work with the ImageFile.Parser interface, fixes #522 2014-02-16 20:58:06 -08:00
Alex Clark
bb1b3a532c Cleanup WS, courtesy of @Arfrever
find * -type f "-(" -name "*.bdf" -o -name "*.c" -o -name "*.h" -o -name "*.py" -o -name "*.rst" -o -name "*.txt" "-)" -exec sed -e "s/[[:space:]]*$//" -i {} \;
2013-06-30 18:42:19 -04:00
kostya0shift
738a1dd777 Better support for ICO images 2013-06-05 21:01:05 +04:00
Alex Clark
3020c16eaa Fix imports 2013-03-07 11:20:28 -05:00
Brian Crowell
848579af9b py3k: Add Windows icon sanity test 2013-01-10 08:47:04 -06:00
Brian Crowell
a7e3b2e47b py3k: The big push
There are two main issues fixed with this commit:

* bytes vs. str: All file, image, and palette data are now handled as
  bytes. A new _binary module consolidates the hacks needed to do this
  across Python versions. tostring/fromstring methods have been renamed to
  tobytes/frombytes, but the Python 2.6/2.7 versions alias them to the old
  names for compatibility. Users should move to tobytes/frombytes.

  One other potentially-breaking change is that text data in image files
  (such as tags, comments) are now explicitly handled with a specific
  character encoding in mind. This works well with the Unicode str in
  Python 3, but may trip up old code expecting a straight byte-for-byte
  translation to a Python string. This also required a change to Gohlke's
  tags tests (in Tests/test_file_png.py) to expect Unicode strings from
  the code.

* True div vs. floor div: Many division operations used the "/" operator
  to do floor division, which is now the "//" operator in Python 3. These
  were fixed.

As of this commit, on the first pass, I have one failing test (improper
handling of a slice object in a C module, test_imagepath.py) in Python 3,
and three that that I haven't tried running yet (test_imagegl,
test_imagegrab, and test_imageqt). I also haven't tested anything on
Windows. All but the three skipped tests run flawlessly against Pythons
2.6 and 2.7.
2013-01-10 08:46:56 -06:00
Brian Crowell
83ff0b3b31 py3k: Use relative imports
In py3k, imports are absolute unless using the "from . import" syntax.

This commit also solves a recursive import between Image, ImageColor, and
ImagePalette by delay-importing ImagePalette in Image.

I'm not too keen on this commit because the syntax is ugly. I might go back
and prefer the prettier "from PIL import".
2013-01-10 08:46:48 -06:00
Brian Crowell
78575798d7 py3k: Update exception usage to modern syntax 2013-01-10 08:46:33 -06:00
Alex Clark
9a640e3157 Forking PIL 2010-07-30 22:52:47 -04:00