code: def _image_xobjects(container):
      
  
      if '/Resources' not in container:
          return
      resources = container['/Resources']
      if '/XObject' not in resources:
          return
      xobjs = resources['/XObject'].as_dict()
      for xobj in xobjs:
          candidate = xobjs[xobj]
          if not '/Subtype' in candidate:
              continue
          if candidate['/Subtype'] == '/Image':
              pdfimage = candidate
              yield (pdfimage, xobj)
docs: Search for all XObject-based images in the container
  
      Usually the container is a page, but it could also be a Form XObject
      that contains images. Filter out the Form XObjects which are dealt with
      elsewhere.
  
      Generate a sequence of tuples (image, xobj container), where container,
      where xobj is the name of the object and image is the object itself,
      since the object does not know its own name.