class_docstr: EPS File Parser for the Python Imaging Library
code: def _open(self):
      (length, offset) = self._find_offset(self.fp)
  
      # Rewrap the open file pointer in something that will
      # convert line endings and decode to latin-1.
      fp = PSFile(self.fp)
  
      # go to offset - start of "%!PS"
      fp.seek(offset)
  
      box = None
  
      self.mode = "RGB"
      self._size = 1, 1  # FIXME: huh?
  
      #
      # Load EPS header
  
      s_raw = fp.readline()
      s = s_raw.strip("\r\n")
  
      while s_raw:
          if s:
              if len(s) > 255:
                  raise SyntaxError("not an EPS file")
  
              try:
                  m = split.match(s)
              except re.error as e:
                  raise SyntaxError("not an EPS file") from e
  
              if m:
                  k, v = m.group(1, 2)
                  self.info[k] = v
                  if k == "BoundingBox":
                      try:
                          # Note: The DSC spec says that BoundingBox
                          # fields should be integers, but some drivers
                          # put floating point values there anyway.
                          box = [int(float(i)) for i in v.split()]
                          self._size = box[2] - box[0], box[3] - box[1]
                          self.tile = [
                              (
                                  "eps",
                                  (0, 0) + self.size,
                                  offset,
                                  (length, box),
                              )
                          ]
                      except Exception:
                          pass
  
              else:
                  m = field.match(s)
                  if m:
                      k = m.group(1)
  
                      if k == "EndComments":
                          break
                      if k[:8] == "PS-Adobe":
                          self.info[k[:8]] = k[9:]
                      else:
                          self.info[k] = ""
                  elif s[0] == "%":
                      # handle non-DSC PostScript comments that some
                      # tools mistakenly put in the Comments section
                      pass
                  else:
                      raise OSError("bad EPS header")
  
          s_raw = fp.readline()
          s = s_raw.strip("\r\n")
  
          if s and s[:1] != "%":
              break
  
      #
      # Scan for an "ImageData" descriptor
  
      while s[:1] == "%":
          if len(s) > 255:
              raise SyntaxError("not an EPS file")
  
          if s[:11] == "%ImageData:":
              # Encoded bitmapped image.
              x, y, bi, mo = s[11:].split(None, 7)[:4]
  
              if int(bi) != 8:
                  break
              try:
                  self.mode = self.mode_map[int(mo)]
              except ValueError:
                  break
  
              self._size = int(x), int(y)
              return
  
          s = fp.readline().strip("\r\n")
          if not s:
              break
  
      if not box:
          raise OSError("cannot determine EPS bounding box")
  
imports: import io
  import os
  import re
  import subprocess
  import sys
  import tempfile
  from .None import Image, ImageFile
  from ._binary import i32le
label_desc: Use image node_id 1 for calling the EpsImageFile obj's underlying member method code with example usage: obj._open() without return types