Class ImgUtils

java.lang.Object
pro.verron.officestamper.utils.image.ImgUtils

public class ImgUtils extends Object
Utility class for image-related operations such as format detection and content type mapping.
  • Method Details

    • detectFormat

      public static Optional<ImgFormat> detectFormat(byte[] bytes)
      Detects the format and dimensions of an image from its byte content.
      Parameters:
      bytes - the byte content of the image
      Returns:
      an Optional containing the detected ImgFormat, or empty if no reader is found
      Throws:
      pro.verron.officestamper.utils.UtilsException - if an I/O error occurs during format detection
    • supportedType

      public static Optional<String> supportedType(String imageType)

      Returns the MIME content type for a given image type string.

      Supported types include: emf, svg, wmf, tif, png, jpeg, gif, bmp.

      Parameters:
      imageType - the image type string (case-insensitive)
      Returns:
      an Optional containing the MIME content type, or empty if the type is not supported