Commit Graph

3083 Commits

Author SHA1 Message Date
artscoop
456bd96565 Fix 32-bit BMP loading (RGBA or RGBX)
PIL choked on perfectly valid BMP files (32 bits with Alpha). It could not handle valid RGBA masks to determine the raw format.
To clarify things, I:
- Rewrote the `BmpImagePlugin.BmpImageFile` class to be far more readable
- Made error messages more explicit (e.g. say that RLE bitmaps are unsupported)
- Made a readable dict to contain BMP header information
- Kept the existing security checks
- Instead of reading palette info by chunks of 3/4 bytes, read the whole palette info at once and parse the data.
- Now works with BMPv4/5 with Alpha (and can be exported to alpha PNG for example)
- Tested load and save with RGB24, RGB8, RGB8L, RGB32 and RGBA32.
- Tested with one bogus file. File not accepted, as expected.

I wanted to test more BMP formats, but I could not find that many images.
But for all the types I tested, it worked flawlessly.
2015-03-04 18:15:56 +01:00
Hugo
2c70c9e5e9 Update CHANGES.rst [CI skip] 2015-03-02 10:45:33 +02:00
Hugo
061c9f41d8 Merge pull request #1121 from radarhere/endian
Let Python do the endian stuff + tests
2015-03-02 10:43:27 +02:00
Hugo
07f67f330e Merge pull request #1120 from radarhere/patch-1
Fixed typo in Tests README.rst
2015-03-02 10:36:34 +02:00
Andrew Murray
f644adbb05 Fixed binary conversion bug, and added corresponding tests 2015-03-02 09:56:47 +11:00
Andrew Murray
ef6f30b674 Fixed typo in Tests README.rst 2015-03-02 09:28:24 +11:00
amoibos
aeb1e61aa7 let python do the endian stuff 2015-03-02 00:16:13 +11:00
wiredfool
9eefe4a7ba Update CHANGES.rst [ci skip] 2015-02-25 10:09:32 -08:00
wiredfool
51eb8b6237 Merge pull request #1114 from benoit-pierre/fix-webp-memory-leak
Fix WebP memory leaks
2015-02-25 10:08:01 -08:00
wiredfool
7badc01426 Merge pull request #1116 from GotenXiao/fix-truetype-documentation
Fix truetype() documentation
2015-02-23 22:01:15 -08:00
Robin Lewis
7fafd09bf5 Document filename parameter as deprecated in truetype() 2015-02-23 12:23:01 +00:00
Robin Lewis
066faeb211 Reference non-deprecated argument in truetype documentation 2015-02-23 12:00:52 +00:00
Benoit Pierre
76bafe20a6 webp: better error checking when using Mux API 2015-02-23 11:10:37 +01:00
Benoit Pierre
fef9c7001d webp: fix memory leak when using Mux API 2015-02-23 11:10:37 +01:00
Benoit Pierre
4930b66aa9 webp: fix memory leak
The "S" format specifier for Py_BuildValue *increases* the object
reference count.
2015-02-23 11:10:37 +01:00
Benoit Pierre
3d5dd3b4fc webp: minor cleanup 2015-02-23 11:10:37 +01:00
Benoit Pierre
4af381c6ba webp: add memory leak test 2015-02-23 11:10:37 +01:00
wiredfool
0bc24cb213 Merge pull request #1110 from radarhere/master
Early webp versions are more lossy.
2015-02-14 12:24:00 -08:00
Hans-Peter Jansen
be30160d57 early versions of webp are known to produce higher deviations: deal with it 2015-02-14 23:50:25 +11:00
wiredfool
43830273a5 Merge pull request #1106 from hugovk/test_tiff_dict
Fix TIFF test for PyPy 2.5.0
2015-02-09 11:32:34 -08:00
hugovk
d12acfee84 Test as_dict() directly instead of as string. Fix for PyPy. 2015-02-08 19:09:39 +02:00
wiredfool
8c88a4d8d3 Update CHANGES.rst [ci skip] 2015-02-05 22:34:13 -08:00
wiredfool
b384a7f992 Merge pull request #1088 from bgilbert/opaque-RGBa
Fast path for opaque pixels in RGBa unpacker
2015-02-05 22:32:58 -08:00
wiredfool
cfbb2b3618 Update CHANGES.rst [ci skip] 2015-02-05 22:29:48 -08:00
wiredfool
66c3d2f6b0 Merge pull request #1096 from immerrr/rgba-premultiplied-codecs
Enable basic support for 'RGBa' raw encoding/decoding
2015-02-05 22:28:51 -08:00
immerrr
d41fed6732 Enable basic support for 'RGBa' raw encoding/decoding 2015-02-02 13:06:56 +03:00
wiredfool
5fa52f8891 Updated Changes.rst [ci skip] 2015-01-30 11:41:22 -08:00
wiredfool
d80c27dc3f Merge pull request #1095 from hugovk/pickle_L_mode
Fix pickling L mode images with no palette
2015-01-30 11:39:50 -08:00
Hugo
70e1db9c9c Update CHANGES.rst [CI skip] 2015-01-30 14:38:13 +02:00
Hugo
95e9379f45 Merge pull request #1091 from wiredfool/repr_png
iPython display hook
2015-01-30 14:37:03 +02:00
hugovk
0f89322216 When unpickling, only put palette if there is one 2015-01-30 14:04:35 +02:00
hugovk
7823197fdd Failing tests to pickle L mode images 2015-01-30 14:00:46 +02:00
wiredfool
8ebdc5b64d Comment typo [ci skip] 2015-01-28 20:23:15 -08:00
wiredfool
8c2a7502a4 Correct the name 2015-01-28 10:02:04 -08:00
wiredfool
05fe86654c Added _repr_png method for ipython display hooks 2015-01-28 09:35:31 -08:00
wiredfool
bc0a54b12d Updated Changes.rst (cve number) [ci skip] 2015-01-26 09:02:27 -08:00
Benjamin Gilbert
77b020b374 Special-case opaque pixels in RGBa unpacker
Avoid the expensive multiply and divide when the pixel is opaque.
On my system, this change gives a 5.76x speedup loading an opaque image
with this call:

    PIL.Image.frombuffer('RGBA', (1000, 1000), buf, 'raw', 'RGBa', 0, 1)
2015-01-24 01:13:58 -05:00
Hugo
adad71c759 Merge pull request #1081 from wiredfool/zipsafe
Turn off zip-safe flag for debug builds
2015-01-21 09:28:30 +02:00
Eric Soroos
5061f7bdde Turn off zip-safe flag for debug builds 2015-01-20 15:00:58 -08:00
Hugo
52734ebd00 Update CHANGES.rst [CI skip] 2015-01-19 11:47:31 +02:00
Hugo
4198a580cf Merge pull request #1079 from wiredfool/maxblock
Adjust buffer size when quality=keep, fixes #148 (again)
2015-01-19 11:46:48 +02:00
wiredfool
1e040feb1b Adjust buffer size when quality=keep, fixes #148 (again) 2015-01-18 10:56:29 -08:00
wiredfool
fbc33970dd Merge pull request #1078 from kmike/png-docs
DOC document compress_level option of Image.save for PNG images
2015-01-15 19:07:12 -08:00
Mikhail Korobov
4713b41ed7 DOC document compress_level Image.save PNG option. 2015-01-15 23:14:30 +05:00
Hugo
264f5d0d96 Update CHANGES.rst [CI skip] 2015-01-08 10:40:22 +02:00
Hugo
efeca060a3 Merge pull request #1072 from wiredfool/pr960
Fix for corrupted bitmaps embedded in truetype fonts.
2015-01-08 10:38:06 +02:00
wiredfool
7937ac1dfb Merge pull request #1071 from Arnie97/patch-1
Changes "import Image" to "from PIL import Image".
2015-01-07 21:46:20 -08:00
wiredfool
8b7b297aba rearranged comments 2015-01-07 21:38:36 -08:00
wiredfool
8cb58bbd72 Fix bitmap tests to account for different metrics for bitmap and ttf fonts on some platforms 2015-01-07 21:38:36 -08:00
Yifu Yu
14a9bba962 Make bitmap test runnable as a standalone. 2015-01-07 21:38:36 -08:00