From 0a88a142c031e1edd37cca8077e9cfde4692ce25 Mon Sep 17 00:00:00 2001 From: Deekshu Kare Date: Fri, 21 Jun 2024 12:11:14 +0200 Subject: [PATCH] function 1 added flags --- src/PIL/McIdasImagePlugin.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/PIL/McIdasImagePlugin.py b/src/PIL/McIdasImagePlugin.py index d2a8f32e7..6d8273894 100644 --- a/src/PIL/McIdasImagePlugin.py +++ b/src/PIL/McIdasImagePlugin.py @@ -21,6 +21,13 @@ import struct from . import Image, ImageFile +branches = { + "1": False, + "2": False, + "3": False, + "4": False, + "5": False, + } def _accept(prefix: bytes) -> bool: 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) if not _accept(s) or len(s) != 256: + branches["1"] = True msg = "not an McIdas area file" raise SyntaxError(msg) @@ -48,16 +56,20 @@ class McIdasImageFile(ImageFile.ImageFile): # get mode if w[11] == 1: + branches["2"] = True mode = rawmode = "L" elif w[11] == 2: + branches["3"] = True # FIXME: add memory map support mode = "I" rawmode = "I;16B" elif w[11] == 4: + branches["4"] = True # FIXME: add memory map support mode = "I" rawmode = "I;32B" else: + branches["5"] = True msg = "unsupported McIdas format" raise SyntaxError(msg)