Commit Graph

48 Commits

Author SHA1 Message Date
wiredfool
90378c8298 Fixing compatibility with the truncated images tests 2016-04-04 05:40:37 -07:00
wiredfool
77da73c90f Catch struct.errors when verifying png files, convert to SyntaxErrors, fixes #1755 2016-04-04 03:08:22 -07:00
Andrew Murray
d21430234e Improved consistency of checks for flush 2015-09-02 23:48:22 +10: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
Antony Lee
4e754e9c55 Use logging instead of print.
cf. #1191.

Only TiffImagePlugin and OLEFileIO still rely on (their own) DEBUG flag.
I left TiffImagePlugin as it is because I hope #1059 gets merged in
first, and OLEFileIO because it uses its own logic.

Untested, as usual.
2015-06-29 12:39:50 -07:00
Hugo
b350a2ac95 Merge pull request #1239 from juztin/master
Setting transparency value to 0 when the tRNS contains only null byte(s)
2015-05-27 22:37:29 +03:00
Andrew Murray
3c7e37d2d7 Replaced old-style classes 2015-05-27 00:07:21 +10:00
Justin Wilson
e317a729f3 Setting transparency value to 0 when the tRNS contains only null byte(s) 2015-05-22 16:37:50 -06:00
Andrew Murray
d1c182cadc Various Flake8 fixes 2015-04-24 09:26:52 +10:00
hugovk
0b79c6e24a Remove unreachable code (if 0) 2015-03-05 21:07:16 +02:00
wiredfool
0b75526ffe Limit total text chunk size to 64k 2014-12-29 17:10:27 -08:00
wiredfool
44286ba3c9 Fix for zlib.decompression bomb in iTXt,zTXt, and iCCP chunks 2014-12-28 22:49:52 -08:00
wiredfool
c770984867 Document all the save params for PNG, and their references [ci skip] 2014-11-19 15:35:33 -08:00
Hugo
ae7b765b53 Fix some Landscape.io errors and warnings 2014-10-01 16:50:33 +03:00
hugovk
8de95676e0 flake8 2014-08-26 16:47:10 +03:00
Fredrik Tolf
a9f4e30641 Save detected non-Latin1 characters as iTXt to preserve them. 2014-07-23 07:43:52 -07:00
Fredrik Tolf
c469dd9ae5 Added support for encoding and decoding iTXt chunks. 2014-07-23 00:28:44 -07:00
hugovk
14c2f86873 Rename bytes variable as read_bytes to avoid the built-in function name. 2014-05-21 21:33:49 +03:00
hugovk
d594c0241a Rename len variables as length to avoid the built-in function name. 2014-05-21 20:45:02 +03:00
wiredfool
f8ce951a2d Merge Changes from master 2014-03-04 22:41:36 -08:00
David Schmidt
6457eed2cb overwrite redundant Image palette with new ImageCore Palette after quantize, fixes #513 2014-03-04 21:44:32 -08:00
David Schmidt
232c175bd9 fixes #513 2014-03-04 21:44:32 -08:00
David Schmidt
f848993c89 fixes #528
Accept 0 as transparency value.
2014-02-25 09:50:42 +01:00
Bruno Renié
e1e64904c7 Cleanup handling of ICC profile, more extensive testing 2014-01-19 19:09:40 +01:00
Bruno Renié
0348fcac51 Fix crash on save when icc_profile is None 2014-01-19 16:40:39 +01:00
wiredfool
d65a2c8018 Save the transparency header by default for PNGs 2013-11-26 15:06:26 -08:00
Alex Clark ☺
07f338f194 Merge pull request #315 from d-schmidt/master
fix Issue #312 + gif optimize improvement
2013-08-22 02:54:43 -07:00
Vytis Banaitis
dbf40a0124 Catch truncated zTXt errors. 2013-08-20 15:17:17 +03:00
David Schmidt
b9ab3f5bf4 fix Issue #312
improve palette handling while saving gif and png
2013-08-02 16:32:49 +02:00
David Schmidt
511adfacf7 fix png decode tRNS pattern 2013-03-21 21:00:25 +01:00
David Schmidt
ecd55629be fix indention 2013-03-21 18:47:37 +01:00
David Schmidt
1a40613ca5 fix indention 2013-03-21 18:43:22 +01:00
David Schmidt
09315f263b fixing save of transparency palette png-images 2013-03-21 18:16:00 +01:00
David Schmidt
1ff2b6630a fixed bug with png-images with transparency palette 2013-03-21 16:54:04 +01:00
Oliver Tonnhofer
6a450e303d reduce PNG palette size for images <255 colors
limit color and trancparency palette to 2^bits entries, when a PNG is
saved with the 'bits' PNG encoder option
2013-03-11 20:58:54 +01:00
Oliver Tonnhofer
6537ba19c3 backport PIL's PNG/Zip improvements
- add new FASTOCTREE quantizer with alpha support
- make ZIP compress level and type configurable
- support reading/writing PNGs with paletted alpha

source 3637439d51
2013-03-11 20:33:04 +01:00
Oliver Tonnhofer
c60bb09fcd Revert "Added support for PNG images with transparency palette"
This reverts commit 5baa1ac1b8.
2013-03-11 19:02:54 +01:00
Alex Clark
3020c16eaa Fix imports 2013-03-07 11:20:28 -05:00
David Schmidt
5baa1ac1b8 Added support for PNG images with transparency palette 2013-02-01 17:52:22 +01: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
31c454b925 py3k: 2to3's "idiom" filter
This is, I guess, a few things the Python devs were just fed up with.

* "while 1" is now "while True"
* Types are compared with isinstance instead of ==
* Sort a list in one go with sorted()

My own twist is to also replace type('') with str, type(()) with tuple,
type([]) with list, type(1) with int, and type(5000.0) with float.
2013-01-10 08:46:53 -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
5076c35cc5 py3k: print is a function
Seriously, if you didn't know that, you've been in a freaking cave, man.
2013-01-10 08:46:46 -06:00
Brian Crowell
09f1081c95 py3k: Fix up uses of dictionary views, ranges, and has_key()
y.has_key(x) is gone (use x in y), and keys(), values(), items(), and
range() all return views.

Some iterables needed to be packed into lists, either because the code
expected a list (such as "range(256) * 3") or because the original
collection was being modified (automatic global declarations).

The Tiff ImageFileDictionary is a special case and will be dealt with in
another commit.
2013-01-10 08:46:42 -06:00
Brian Crowell
78575798d7 py3k: Update exception usage to modern syntax 2013-01-10 08:46:33 -06:00
Brian Crowell
37f22ebfcd py3k: Use string methods instead of string module
First, we go for the obvious stuff. The string module methods are gone in
3.0, so we translate them to the appropriate methods on the string class.
2013-01-10 08:42:49 -06:00
Alex Clark
9a640e3157 Forking PIL 2010-07-30 22:52:47 -04:00