code: private List<Content> rewriteImage(Element element) {
  
      // resolve media metadata from DOM element
      Media media = getImageMedia(element);
  
      // build image for media metadata
      Element imageElement = buildImageElement(media, element);
  
      // return modified element
      List<Content> content = new ArrayList<Content>();
      if (imageElement != null) {
        content.add(imageElement);
      }
      return content;
    }
docs: Checks if the given image element has to be rewritten.
  @param element Element to check
  @return null if nothing is to do with this element.
  Return empty list to remove this element.
  Return list with other content to replace element with new content.