Package org.apache.ofbiz.common.image
Class ImageTransform
java.lang.Object
org.apache.ofbiz.common.image.ImageTransform
ImageTransform Class
Services to apply transformation to images
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetBufferedImage
(String fileLocation, Locale locale) getBufferedImagegetXMLValue
(String fileFullPath, Locale locale) getXMLValuescaleImage
(BufferedImage bufImg, double imgHeight, double imgWidth, Map<String, Map<String, String>> dimensionMap, String sizeType, Locale locale) scaleImagestatic BufferedImage
toBufferedImage
(Image image) toBufferedImagestatic BufferedImage
toBufferedImage
(Image image, int bufImgType)
-
Constructor Details
-
ImageTransform
public ImageTransform()
-
-
Method Details
-
getBufferedImage
public static Map<String,Object> getBufferedImage(String fileLocation, Locale locale) throws IllegalArgumentException, IOException getBufferedImageSet 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 parsedIllegalArgumentException
- 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) scaleImagescale original image related to the ImageProperties.xml dimensions
- Parameters:
bufImg
- Buffered image to scaleimgHeight
- Original image heightimgWidth
- Original image widthdimensionMap
- Image dimensions by size typesizeType
- Size type to scale- Returns:
- New scaled buffered image
-
getXMLValue
public static Map<String,Object> getXMLValue(String fileFullPath, Locale locale) throws IllegalStateException, IOException getXMLValueFrom 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
toBufferedImageTransform from an Image instance to a BufferedImage instance
- Parameters:
image
- Source image- Returns:
- BufferedImage
-
toBufferedImage
-