Class ImageTransform

java.lang.Object
org.apache.ofbiz.common.image.ImageTransform

public class ImageTransform extends Object
ImageTransform Class

Services to apply transformation to images

  • Constructor Details

    • ImageTransform

      public ImageTransform()
  • Method Details

    • getBufferedImage

      public static Map<String,Object> getBufferedImage(String fileLocation, Locale locale) throws IllegalArgumentException, IOException
      getBufferedImage

      Set a buffered image

      Parameters:
      fileLocation - Full file Path or URL
      Returns:
      URL images for all different size types
      Throws:
      IOException - Error prevents the document from being fully parsed
      IllegalArgumentException - Errors occur in parsing
    • scaleImage

      public static Map<String,Object> scaleImage(BufferedImage bufImg, double imgHeight, double imgWidth, Map<String,Map<String,String>> dimensionMap, String sizeType, Locale locale)
      scaleImage

      scale original image related to the ImageProperties.xml dimensions

      Parameters:
      bufImg - Buffered image to scale
      imgHeight - Original image height
      imgWidth - Original image width
      dimensionMap - Image dimensions by size type
      sizeType - Size type to scale
      Returns:
      New scaled buffered image
    • getXMLValue

      public static Map<String,Object> getXMLValue(String fileFullPath, Locale locale) throws IllegalStateException, IOException
      getXMLValue

      From a XML element, get a values map

      Parameters:
      fileFullPath - File path to parse
      Returns:
      Map contains asked attribute values by attribute name
      Throws:
      IllegalStateException
      IOException
    • toBufferedImage

      public static BufferedImage toBufferedImage(Image image)
      toBufferedImage

      Transform from an Image instance to a BufferedImage instance

      Parameters:
      image - Source image
      Returns:
      BufferedImage
    • toBufferedImage

      public static BufferedImage toBufferedImage(Image image, int bufImgType)