diff --git a/src/PIL/Image.py b/src/PIL/Image.py index a770488b7..f980bb241 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -1561,7 +1561,7 @@ class Image: """ return ( self.mode in ("LA", "La", "PA", "RGBA", "RGBa") - or (self.mode == "P" and self.palette.mode.endswith("A")) + or (self.mode == "P" and self.palette and self.palette.mode.endswith("A")) or "transparency" in self.info )