Added CMYK mode for opening EPS files

This commit is contained in:
Andrew Murray 2016-04-13 18:27:46 +10:00
parent d2a7de2c25
commit 392d567352
3 changed files with 7 additions and 1 deletions

View File

@ -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)

Binary file not shown.

View File

@ -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)