Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RLE8 compression support for Bitmap images #3426

Closed
bbotezatu opened this issue Oct 22, 2018 · 1 comment
Closed

RLE8 compression support for Bitmap images #3426

bbotezatu opened this issue Oct 22, 2018 · 1 comment

Comments

@bbotezatu
Copy link

What did you do?

Attempted to open an RLE8-compressed bitmap image.

What did you expect to happen?

The image to display correctly.

What actually happened?

An IOError("Unsupported BMP compression (%d)" % file_info['compression']) was thrown.

We try to open the image in our main program:

        try:
            image = Image.open(path)
            ...

This calls the BmpImageFile class from BmpImagePlugin.py, which attempts to display the file according to the compression types listed in the dictionary on line 63:

COMPRESSIONS = {
        'RAW': 0,
        'RLE8': 1,
        'RLE4': 2,
        'BITFIELDS': 3,
        'JPEG': 4,
        'PNG': 5
    }
    RAW, RLE8, RLE4, BITFIELDS, JPEG, PNG = 0, 1, 2, 3, 4, 5

After reading header data, the program continues; on line 158, an if statement checks:

if file_info['compression'] == self.BITFIELDS:

which evaluates to false. So, the program then jumps to line 190, where it checks whether the file's compression type is RAW:

elif file_info['compression'] == self.RAW:

which also evaluates to false. This causes the program to jump the code block to line 193, where the exception is thrown, and causes our main program to fail.

raise IOError("Unsupported BMP compression (%d)" %

The code that ultimately throws this exception is found at line 194, in the BmpImagePlugin source.

What are your OS, Python and Pillow versions?

  • OS: Windows 10
  • Python: 3.6.3
  • Pillow: 5.2.0

testImages.zip

@hugovk
Copy link
Member

hugovk commented Oct 22, 2018

Closing as a duplicate of #3425, caused by today's GitHub data storage problems:

image

@hugovk hugovk closed this as completed Oct 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants