did not work with all .cur files

This commit is contained in:
jlwoolf 2022-09-21 17:44:57 -06:00
parent 25664d8201
commit 32a6c2268f
2 changed files with 5 additions and 1 deletions

View File

@ -209,7 +209,10 @@ class BmpImageFile(ImageFile.ImageFile):
else:
raise OSError("Unsupported BMP bitfields layout")
elif file_info["compression"] == self.RAW:
if file_info["bits"] == 32 and header == 22: # 32-bit .cur offset
try: self.is_cur
except: self.is_cur = False
if file_info["bits"] == 32 and self.is_cur:
raw_mode, self.mode = "BGRA", "RGBA"
elif file_info["compression"] == self.RLE8:
decoder_name = "bmp_rle"

View File

@ -44,6 +44,7 @@ class CurImageFile(BmpImagePlugin.BmpImageFile):
s = self.fp.read(6)
if not _accept(s):
raise SyntaxError("not a CUR file")
self.is_cur = True
# pick the largest cursor in the file
m = b""