mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-24 06:53:12 +03:00
function 1 added flags
This commit is contained in:
parent
5320e45a11
commit
0a88a142c0
|
@ -21,6 +21,13 @@ import struct
|
||||||
|
|
||||||
from . import Image, ImageFile
|
from . import Image, ImageFile
|
||||||
|
|
||||||
|
branches = {
|
||||||
|
"1": False,
|
||||||
|
"2": False,
|
||||||
|
"3": False,
|
||||||
|
"4": False,
|
||||||
|
"5": False,
|
||||||
|
}
|
||||||
|
|
||||||
def _accept(prefix: bytes) -> bool:
|
def _accept(prefix: bytes) -> bool:
|
||||||
return prefix[:8] == b"\x00\x00\x00\x00\x00\x00\x00\x04"
|
return prefix[:8] == b"\x00\x00\x00\x00\x00\x00\x00\x04"
|
||||||
|
@ -40,6 +47,7 @@ class McIdasImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
s = self.fp.read(256)
|
s = self.fp.read(256)
|
||||||
if not _accept(s) or len(s) != 256:
|
if not _accept(s) or len(s) != 256:
|
||||||
|
branches["1"] = True
|
||||||
msg = "not an McIdas area file"
|
msg = "not an McIdas area file"
|
||||||
raise SyntaxError(msg)
|
raise SyntaxError(msg)
|
||||||
|
|
||||||
|
@ -48,16 +56,20 @@ class McIdasImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
# get mode
|
# get mode
|
||||||
if w[11] == 1:
|
if w[11] == 1:
|
||||||
|
branches["2"] = True
|
||||||
mode = rawmode = "L"
|
mode = rawmode = "L"
|
||||||
elif w[11] == 2:
|
elif w[11] == 2:
|
||||||
|
branches["3"] = True
|
||||||
# FIXME: add memory map support
|
# FIXME: add memory map support
|
||||||
mode = "I"
|
mode = "I"
|
||||||
rawmode = "I;16B"
|
rawmode = "I;16B"
|
||||||
elif w[11] == 4:
|
elif w[11] == 4:
|
||||||
|
branches["4"] = True
|
||||||
# FIXME: add memory map support
|
# FIXME: add memory map support
|
||||||
mode = "I"
|
mode = "I"
|
||||||
rawmode = "I;32B"
|
rawmode = "I;32B"
|
||||||
else:
|
else:
|
||||||
|
branches["5"] = True
|
||||||
msg = "unsupported McIdas format"
|
msg = "unsupported McIdas format"
|
||||||
raise SyntaxError(msg)
|
raise SyntaxError(msg)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user