add link to %ImageData definition

and remove empty comment lines
This commit is contained in:
Yay295 2023-03-02 15:26:06 -06:00
parent 4f9c3847e8
commit 60b717a94b

View File

@ -31,9 +31,9 @@ from . import Image, ImageFile
from ._binary import i32le as i32 from ._binary import i32le as i32
from ._deprecate import deprecate from ._deprecate import deprecate
#
# -------------------------------------------------------------------- # --------------------------------------------------------------------
split = re.compile(r"^%%([^:]*):[ \t]*(.*)[ \t]*$") split = re.compile(r"^%%([^:]*):[ \t]*(.*)[ \t]*$")
field = re.compile(r"^%[%!\w]([^:]*)[ \t]*$") field = re.compile(r"^%[%!\w]([^:]*)[ \t]*$")
@ -319,11 +319,12 @@ class EpsImageFile(ImageFile.ImageFile):
raise OSError(msg) raise OSError(msg)
elif bytes_mv[:11] == b"%ImageData:": elif bytes_mv[:11] == b"%ImageData:":
# Check for an "ImageData" descriptor # Check for an "ImageData" descriptor
# https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577413_pgfId-1035096
# Values: # Values:
# columns # columns
# rows # rows
# bit depth # bit depth (1 or 8)
# mode (1: L, 2: LAB, 3: RGB, 4: CMYK) # mode (1: L, 2: LAB, 3: RGB, 4: CMYK)
# number of padding channels # number of padding channels
# block size (number of bytes per row per channel) # block size (number of bytes per row per channel)
@ -395,18 +396,15 @@ class EpsImageFile(ImageFile.ImageFile):
pass pass
#
# -------------------------------------------------------------------- # --------------------------------------------------------------------
def _save(im, fp, filename, eps=1): def _save(im, fp, filename, eps=1):
"""EPS Writer for the Python Imaging Library.""" """EPS Writer for the Python Imaging Library."""
#
# make sure image data is available # make sure image data is available
im.load() im.load()
#
# determine PostScript image mode # determine PostScript image mode
if im.mode == "L": if im.mode == "L":
operator = (8, 1, b"image") operator = (8, 1, b"image")
@ -419,7 +417,6 @@ def _save(im, fp, filename, eps=1):
raise ValueError(msg) raise ValueError(msg)
if eps: if eps:
#
# write EPS header # write EPS header
fp.write(b"%!PS-Adobe-3.0 EPSF-3.0\n") fp.write(b"%!PS-Adobe-3.0 EPSF-3.0\n")
fp.write(b"%%Creator: PIL 0.1 EpsEncode\n") fp.write(b"%%Creator: PIL 0.1 EpsEncode\n")
@ -431,7 +428,6 @@ def _save(im, fp, filename, eps=1):
fp.write(b"%%ImageData: %d %d " % im.size) fp.write(b"%%ImageData: %d %d " % im.size)
fp.write(b'%d %d 0 1 1 "%s"\n' % operator) fp.write(b'%d %d 0 1 1 "%s"\n' % operator)
#
# image header # image header
fp.write(b"gsave\n") fp.write(b"gsave\n")
fp.write(b"10 dict begin\n") fp.write(b"10 dict begin\n")
@ -452,7 +448,6 @@ def _save(im, fp, filename, eps=1):
fp.flush() fp.flush()
#
# -------------------------------------------------------------------- # --------------------------------------------------------------------