Commit Graph

3095 Commits

Author SHA1 Message Date
artscoop
9e3af5a161 Fix .cur 32/rgba, offsets etc.
Various fixes on code broken or not passing tests
2015-03-05 10:40:10 +01:00
artscoop
d7a78f3813 Fixing .cur special header offset
use offset provided
2015-03-05 09:02:09 +01:00
artscoop
82aa9011c9 Restored original error messages
I suspect the tests to check against an exact string when expecting an error
2015-03-05 08:47:34 +01:00
artscoop
c8fddb19f5 Update BmpImagePlugin.py
Getting bonkers but I need to know
2015-03-05 08:34:01 +01:00
artscoop
934651427d Use 1 and not P for basic 1bpp BMP
Readapted some original code.
2015-03-05 08:19:14 +01:00
artscoop
56439b728f Test with original code
...
2015-03-04 23:06:21 +01:00
artscoop
f953b98285 Try to fix tests
Choked on roundtrip, where a P;1 image was returned instead of a 1 image.
2015-03-04 22:40:04 +01:00
artscoop
7b657f6887 Fix for all good_tests
Fixed loading of all types of provided images (+rgba). Added edge case where the header is reported as 40 bytes long with BITFIELDS (they start past the 40 bytes of the header). Loading fails for RLE, but IIRC, they're unsupported so it's normal.
2015-03-04 22:05:32 +01:00
artscoop
c8551770eb Quickfix number 4
Until tests pass.
2015-03-04 19:55:08 +01:00
artscoop
497ddf9c68 Remember correct image offset if bitfields+palette
Use the provided image offset if there is palette data while the image is bitfielded.
2015-03-04 19:50:52 +01:00
artscoop
877c138e21 1bpp BMP fix
It appears that
{{{
  The handling of 1bpp bitmaps is a little complicated.
  When reading 1bpp bitmaps, the palette is ignored.
  1's are considered foreground, and they are considered black.
  0's are considered background, and they are considered white.
}}}
so the raw mode has to be `1;I`
2015-03-04 19:26:15 +01:00
artscoop
c0ce8d0ae8 Removed debug print
Debug print left in _save. Removed.
2015-03-04 18:29:28 +01:00
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