docs: def to_image(self, digest, blob, mime_type, index, size=500):
          """Convert a file to a list of images.
  
          Returns image at the given index.
          """
          # Special case, for now (XXX).
          if mime_type.startswith("image/"):
              return ""
  
          cache_key = f"img:{index}:{size}:{digest}"
          converted = self.cache.get(cache_key)
          if converted:
              return converted
  
          # Direct conversion possible
          for handler in self.handlers:
              if handler.accept(mime_type, "image/jpeg"):
                  converted_images = handler.convert(blob, size=size)
                  for i in range(0, len(converted_images)):
                      converted = converted_images[i]
                      cache_key = f"img:{i}:{size}:{digest}"
                      self.cache[cache_key] = converted
                  return converted_images[index]
  
          # Use PDF as a pivot format
          pdf = self.to_pdf(digest, blob, mime_type)
          for handler in self.handlers:
              if handler.accept("application/pdf", "image/jpeg"):
                  converted_images = handler.convert(pdf, size=size)
                  for i in range(0, len(converted_images)):
                      converted = converted_images[i]
                      cache_key = f"img:{i}:{size}:{digest}"
                      self.cache[cache_key] = converted
                  return converted_images[index]
  
          raise HandlerNotFound(f"No handler found to convert from {mime_type} to image")