mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 18:26:17 +03:00
commit
872fd0652e
|
@ -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)
|
||||
|
|
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,21 @@ 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")
|
||||
|
||||
cmyk_image.load()
|
||||
self.assertEqual(cmyk_image.mode, "RGB")
|
||||
|
||||
if 'jpeg_decoder' in dir(Image.core):
|
||||
target = Image.open('Tests/images/pil_sample_rgb.jpg')
|
||||
self.assert_image_similar(cmyk_image, target, 10)
|
||||
|
||||
|
||||
def test_file_object(self):
|
||||
# issue 479
|
||||
image1 = Image.open(file1)
|
||||
|
|
|
@ -34,7 +34,11 @@ EPS
|
|||
|
||||
PIL identifies EPS files containing image data, and can read files that contain
|
||||
embedded raster images (ImageData descriptors). If Ghostscript is available,
|
||||
other EPS files can be read as well. The EPS driver can also write EPS images.
|
||||
other EPS files can be read as well. The EPS driver can also write EPS
|
||||
images. The EPS driver can read EPS images in ``L``, ``LAB``, ``RGB`` and
|
||||
``CMYK`` mode, but Ghostscript may convert the images to ``RGB`` mode rather
|
||||
than leaving them in the original color space. The EPS driver can write images
|
||||
in ``L``, ``RGB`` and ``CMYK`` modes.
|
||||
|
||||
If Ghostscript is available, you can call the :py:meth:`~PIL.Image.Image.load`
|
||||
method with the following parameter to affect how Ghostscript renders the EPS
|
||||
|
|
Loading…
Reference in New Issue
Block a user