code: private boolean isSizeMatchingRequest(MediaArgs mediaArgs, String[] requestedFileExtensions) {
  
      // check that at least one image file extension is in the list of requested extensions
      boolean anyImageFileExtension = false;
      for (String fileExtension : requestedFileExtensions) {
        if (FileExtension.isImage(fileExtension)) {
          anyImageFileExtension = true;
        }
      }
      if (!anyImageFileExtension && mediaArgs.getFixedWidth() == 0 && mediaArgs.getFixedHeight() == 0) {
        return false;
      }
  
      // check for size restriction
      if (mediaArgs.getFixedWidth() > 0 || mediaArgs.getFixedHeight() > 0) {
        return true;
      }
      Boolean isSizeMatchingMediaFormat = visitMediaFormats(mediaArgs, new MediaFormatVisitor<Boolean>() {
        @Override
        public Boolean visit(MediaFormat mediaFormat) {
          if (mediaFormat.getEffectiveMinWidth() > 0
              || mediaFormat.getEffectiveMaxWidth() > 0
              || mediaFormat.getEffectiveMinHeight() > 0
              || mediaFormat.getEffectiveMaxHeight() > 0
              || mediaFormat.getRatio() > 0) {
            return true;
          }
          return null;
        }
      });
      return isSizeMatchingMediaFormat != null && isSizeMatchingMediaFormat.booleanValue();
    }
docs: Checks if the media args contain any with/height restriction, that means a rendition matching
  the given size constraints is requested. Additionally it is checked that at least one image file
  extension is requested.
  @param mediaArgs Media arguments
  @return true if any size restriction was defined.