mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-29 02:03:25 +03:00
notes about %ImageData, and use better var names
This commit is contained in:
parent
dd985b2a5e
commit
4f9c3847e8
|
@ -320,20 +320,32 @@ class EpsImageFile(ImageFile.ImageFile):
|
||||||
elif bytes_mv[:11] == b"%ImageData:":
|
elif bytes_mv[:11] == b"%ImageData:":
|
||||||
# Check for an "ImageData" descriptor
|
# Check for an "ImageData" descriptor
|
||||||
|
|
||||||
# Encoded bitmapped image.
|
# Values:
|
||||||
x, y, bi, mo = byte_arr[11:bytes_read].split(None, 7)[:4]
|
# columns
|
||||||
|
# rows
|
||||||
|
# bit depth
|
||||||
|
# mode (1: L, 2: LAB, 3: RGB, 4: CMYK)
|
||||||
|
# number of padding channels
|
||||||
|
# block size (number of bytes per row per channel)
|
||||||
|
# binary/ascii (1: binary, 2: ascii)
|
||||||
|
# data start identifier (the image data follows after a single line
|
||||||
|
# consisting only of this quoted value)
|
||||||
|
image_data_values = byte_arr[11:bytes_read].split(None, 7)
|
||||||
|
columns, rows, bit_depth, mode_id = [
|
||||||
|
int(value) for value in image_data_values[:4]
|
||||||
|
]
|
||||||
|
|
||||||
if int(bi) == 1:
|
if bit_depth == 1:
|
||||||
self.mode = "1"
|
self.mode = "1"
|
||||||
elif int(bi) == 8:
|
elif bit_depth == 8:
|
||||||
try:
|
try:
|
||||||
self.mode = self.mode_map[int(mo)]
|
self.mode = self.mode_map[mode_id]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
self._size = int(x), int(y)
|
self._size = columns, rows
|
||||||
return
|
return
|
||||||
|
|
||||||
bytes_read = 0
|
bytes_read = 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user