diff --git a/PIL/EpsImagePlugin.py b/PIL/EpsImagePlugin.py index a950c52b9..9a668125a 100644 --- a/PIL/EpsImagePlugin.py +++ b/PIL/EpsImagePlugin.py @@ -201,7 +201,7 @@ class EpsImageFile(ImageFile.ImageFile): format = "EPS" format_description = "Encapsulated Postscript" - mode_map = {1: "L", 2: "LAB", 3: "RGB"} + mode_map = {1: "L", 2: "LAB", 3: "RGB", 4: "CMYK"} def _open(self): (length, offset) = self._find_offset(self.fp) diff --git a/Tests/images/pil_sample_cmyk.eps b/Tests/images/pil_sample_cmyk.eps new file mode 100644 index 000000000..3b4d4de1d Binary files /dev/null and b/Tests/images/pil_sample_cmyk.eps differ diff --git a/Tests/test_file_eps.py b/Tests/test_file_eps.py index 7e6207976..a68a72245 100644 --- a/Tests/test_file_eps.py +++ b/Tests/test_file_eps.py @@ -57,6 +57,12 @@ class TestFileEps(PillowTestCase): self.assertRaises(SyntaxError, lambda: EpsImagePlugin.EpsImageFile(invalid_file)) + def test_cmyk(self): + cmyk_image = Image.open("Tests/images/pil_sample_cmyk.eps") + self.assertEqual(cmyk_image.mode, "CMYK") + self.assertEqual(cmyk_image.size, (100, 100)) + self.assertEqual(cmyk_image.format, "EPS") + def test_file_object(self): # issue 479 image1 = Image.open(file1)