Pillow/PIL
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
..
__init__.py Version Bump --2.7.0 2014-12-31 20:42:57 -08:00
_binary.py Fixed binary conversion bug, and added corresponding tests 2015-03-02 09:56:47 +11:00
_util.py flake8 2014-07-06 01:50:24 +03:00
BdfFontFile.py flake8 2014-08-26 16:47:10 +03:00
BmpImagePlugin.py Fix 32-bit BMP loading (RGBA or RGBX) 2015-03-04 18:15:56 +01:00
BufrStubImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
ContainerIO.py flake8 2014-08-26 16:47:10 +03:00
CurImagePlugin.py Flake8 and fix typo 2014-07-17 00:12:54 +03:00
DcxImagePlugin.py flake8 2014-07-17 01:21:56 +03:00
EpsImagePlugin.py flake8 + typo: infile_temo -> infile_temp 2014-09-14 12:08:31 +03:00
ExifTags.py Correct the correction: RelatedImageWidth=0x1001, RelatedImageLength=0x1002 2014-08-27 11:06:34 +03:00
FitsStubImagePlugin.py Fix imports 2013-03-07 11:20:28 -05:00
FliImagePlugin.py flake8 2014-08-28 14:44:19 +03:00
FontFile.py Remove unused WIP save2() from pre-fork days 2014-07-05 23:02:34 +03:00
FpxImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
GbrImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
GdImageFile.py flake8 2014-08-26 16:47:10 +03:00
GifImagePlugin.py The optimization algorithm is only applicable to the image of mode="P" or "L". 2014-11-06 21:29:27 +09:00
GimpGradientFile.py Fix for Python 3 2014-08-26 12:23:12 +03:00
GimpPaletteFile.py flake8 2014-08-28 17:18:54 +03:00
GribStubImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
Hdf5StubImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
IcnsImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
IcoImagePlugin.py Comment typo [ci skip] 2015-01-28 20:23:15 -08:00
Image.py Merge pull request #1095 from hugovk/pickle_L_mode 2015-01-30 11:39:50 -08:00
ImageChops.py Remove old ImageChops comments; redundant with docstrings 2013-10-11 22:46:57 -07:00
ImageCms.py Fix rename regression 2014-10-02 12:43:49 +03:00
ImageColor.py flake8 2014-08-26 16:47:10 +03:00
ImageDraw.py flake8 2014-08-28 14:44:19 +03:00
ImageDraw2.py flake8 2014-08-26 16:47:10 +03:00
ImageEnhance.py Fix for alpha preservation in ImageEnhance, #899 2014-09-18 09:10:08 -07:00
ImageFile.py Merge branch 'master' into flake8 2014-09-14 10:23:51 +03:00
ImageFileIO.py Transformed docstrings of ImageFile and ImageFileIO modules 2013-07-19 15:11:26 +00:00
ImageFilter.py Fixed warning on docs building (url can't wrap), added parameters 2014-12-31 16:35:56 -08:00
ImageFont.py Document filename parameter as deprecated in truetype() 2015-02-23 12:23:01 +00:00
ImageGrab.py Improve the error message when importing ImageGrab on non-Windows (#901) 2014-09-16 16:05:22 +03:00
ImageMath.py flake8 ImageMath.py 2014-07-05 12:13:43 +03:00
ImageMode.py flake8 2014-08-26 16:47:10 +03:00
ImageMorph.py flake8 2014-08-26 16:47:10 +03:00
ImageOps.py Some landscape.io fixes 2014-11-27 21:43:45 +02:00
ImagePalette.py More ImagePalette.py tests and remove unused and uncallable new() 2014-07-21 23:18:46 +03:00
ImagePath.py Fully document PIL.ImagePath 2013-10-13 21:41:21 -07:00
ImageQt.py Some landscape.io fixes 2014-11-27 21:43:45 +02:00
ImageSequence.py flake8 2014-08-26 16:47:10 +03:00
ImageShow.py flake8 2014-08-26 16:47:10 +03:00
ImageStat.py flake8 2014-08-26 16:47:10 +03:00
ImageTk.py flake8 2014-08-26 16:47:10 +03:00
ImageTransform.py flake8 2014-08-26 16:47:10 +03:00
ImageWin.py Merge from master 2014-09-23 09:52:03 -07:00
ImImagePlugin.py flake8 2014-08-28 14:44:19 +03:00
ImtImagePlugin.py flake8 2014-08-28 14:44:19 +03:00
IptcImagePlugin.py Remove disabled _is_raw() 2014-08-01 11:12:47 +03:00
Jpeg2KImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
JpegImagePlugin.py Adjust buffer size when quality=keep, fixes #148 (again) 2015-01-18 10:56:29 -08:00
JpegPresets.py flake8 2014-08-28 14:44:19 +03:00
McIdasImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
MicImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
MpegImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
MpoImagePlugin.py flake8 2014-08-28 14:44:19 +03:00
MspImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
OleFileIO-README.md Fix link 2014-06-03 09:01:57 -04:00
OleFileIO.py Make OleFileIO.py executable, fix shebang 2014-10-03 09:59:25 +02:00
PaletteFile.py flake8 2014-08-26 16:47:10 +03:00
PalmImagePlugin.py Ensure rowbytes is an integer (fix for Python 3) 2014-07-01 22:36:56 +03:00
PcdImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
PcfFontFile.py flake8 2014-08-26 16:47:10 +03:00
PcxImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
PdfImagePlugin.py Merge from master, pre-unittest conversion 2014-06-03 14:42:22 -07:00
PixarImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
PngImagePlugin.py Limit total text chunk size to 64k 2014-12-29 17:10:27 -08:00
PpmImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
PsdImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
PSDraw.py flake8 2014-12-27 23:07:41 +02:00
PyAccess.py Docs for PyAccess, PixelAccess objects [ci skip] 2014-11-19 14:04:39 -08:00
SgiImagePlugin.py If we can't read a file due to unsupported compression, raise an error 2014-07-20 01:50:05 +03:00
SpiderImagePlugin.py pep8/pyflakes 2014-05-26 21:56:40 +03:00
SunImagePlugin.py flake8 2014-07-16 14:26:30 +03:00
TarIO.py flake8 2014-08-26 16:47:10 +03:00
TgaImagePlugin.py flake8 and tests 2014-08-20 10:32:06 +04:00
TiffImagePlugin.py Use underscores, not spaces, in TIFF tag kwargs. 2014-12-09 15:17:33 -08:00
TiffTags.py flake8 2014-08-26 15:52:37 +03:00
WalImageFile.py Convert file to utf-8 2014-10-03 09:57:32 +02:00
WebPImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
WmfImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
XbmImagePlugin.py flake8 2014-08-26 16:47:10 +03:00
XpmImagePlugin.py flake8 2014-07-17 02:40:14 +03:00
XVThumbImagePlugin.py flake8 2014-08-28 14:44:19 +03:00