public class ImageUtils extends Object
| Constructor and Description |
|---|
ImageUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
base64FromImage(BufferedImage image) |
static BufferedImage |
copyImageWithType(BufferedImage src,
int updatedType)
Creates a copy of an image with an updated image type.
|
static byte[] |
encodeAsPng(BufferedImage image)
Encodes a given image as PNG.
|
static BufferedImage |
getImagePart(BufferedImage image,
Region region)
Get a copy of the part of the image given by region.
|
static BufferedImage |
imageFromBase64(String image64)
Creates a
BufferedImage instance from a base64 encoding of an
image's bytes. |
static BufferedImage |
imageFromBytes(byte[] imageBytes)
Creates a BufferedImage instance from raw image bytes.
|
static BufferedImage |
imageFromFile(String path) |
static BufferedImage |
imageFromResource(String resource) |
static BufferedImage |
rotateImage(BufferedImage image,
double deg) |
static BufferedImage |
scaleImage(BufferedImage image,
ScaleMethod scaleMethod,
double scaleRatio)
Scales an image by the given ratio
|
public static byte[] encodeAsPng(BufferedImage image)
image - The image to encode.public static BufferedImage imageFromFile(String path) throws EyesException
EyesExceptionpublic static BufferedImage imageFromResource(String resource) throws EyesException
EyesExceptionpublic static BufferedImage imageFromBase64(String image64) throws EyesException
BufferedImage instance from a base64 encoding of an
image's bytes.image64 - The base64 encoding of an image's bytes.BufferedImage instance.EyesException - If there was a problem
creating the BufferedImage instance.public static String base64FromImage(BufferedImage image)
image - The image from which to get its base64 representation.public static BufferedImage imageFromBytes(byte[] imageBytes) throws EyesException
imageBytes - The raw bytes of the image.EyesException - If there was a problem
creating the BufferedImage instance.public static BufferedImage getImagePart(BufferedImage image, Region region)
image - The image from which to get the part.region - The region which should be copied from the image.public static BufferedImage rotateImage(BufferedImage image, double deg)
public static BufferedImage copyImageWithType(BufferedImage src, int updatedType)
src - The image to copy.updatedType - The type of the copied image.
See BufferedImage.getType().src of the requested type.public static BufferedImage scaleImage(BufferedImage image, ScaleMethod scaleMethod, double scaleRatio)
image - The image to scale.scaleMethod - The method used in order to scale the image.scaleRatio - The ratio by which to scale the image.Copyright © 2016. All rights reserved.