code: private static @Nullable Dimension getDimensionFromImageBinary(@NotNull Rendition rendition,
        boolean suppressLogWarningNoRenditionsMetadata) {
      try (InputStream is = rendition.getStream()) {
        if (is != null) {
          if (!suppressLogWarningNoRenditionsMetadata) {
            log.warn("Unable to detect rendition metadata for {}, "
                + "fallback to inefficient detection by loading image into in memory. "
                + "Please check if the service user for the bundle 'io.wcm.handler.media' is configured properly.",
                rendition.getPath());
          }
          Layer layer = new Layer(is);
          long width = layer.getWidth();
          long height = layer.getHeight();
          return toDimension(width, height);
        }
        else {
          log.warn("Unable to get binary stream for rendition {}", rendition.getPath());
        }
      }
      catch (IOException ex) {
        log.warn("Unable to read binary stream to layer for rendition {}", rendition.getPath(), ex);
      }
      return null;
    }
docs: Fallback: Read dimension by loading image binary into memory.
  @param rendition Rendition
  @param suppressLogWarningNoRenditionsMetadata If set to true, no log warnings is generated when
  renditions metadata containing the with/height of the rendition does not exist (yet).
  @return Dimension or null