mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Added CMYK mode for opening EPS files
This commit is contained in:
parent
d2a7de2c25
commit
392d567352
|
@ -201,7 +201,7 @@ class EpsImageFile(ImageFile.ImageFile):
|
||||||
format = "EPS"
|
format = "EPS"
|
||||||
format_description = "Encapsulated Postscript"
|
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):
|
def _open(self):
|
||||||
(length, offset) = self._find_offset(self.fp)
|
(length, offset) = self._find_offset(self.fp)
|
||||||
|
|
BIN
Tests/images/pil_sample_cmyk.eps
Normal file
BIN
Tests/images/pil_sample_cmyk.eps
Normal file
Binary file not shown.
|
@ -57,6 +57,12 @@ class TestFileEps(PillowTestCase):
|
||||||
self.assertRaises(SyntaxError,
|
self.assertRaises(SyntaxError,
|
||||||
lambda: EpsImagePlugin.EpsImageFile(invalid_file))
|
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):
|
def test_file_object(self):
|
||||||
# issue 479
|
# issue 479
|
||||||
image1 = Image.open(file1)
|
image1 = Image.open(file1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user