Package io.scanbot.sdk.imagemanipulation
Class ImageManipulator
- java.lang.Object
-
- io.scanbot.sdk.imagemanipulation.ImageManipulator
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class ImageManipulator extends java.lang.Object implements java.lang.AutoCloseableAPI for image processing. If applicable on the platform, all the methods return images with the same liveness flag as the input image.
-
-
Constructor Summary
Constructors Constructor Description ImageManipulator()Constructs ImageManipulator with the given params.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes native resources held by the object.ImageRefcropRect(ImageRef image, RectangleF rect)Crops out the given rectangle from the image.protected voidfinalize()ImageRefflip(ImageRef image, ImageOrigin origin)Flips the given image horizontally or vertically.ImageRefresize(ImageRef image, int size)Resizes the given image to the given size.ImageRefrotate(ImageRef image, ImageRotation rotation)Rotates the given image by the given angle.
-
-
-
Method Detail
-
cropRect
public ImageRef cropRect(ImageRef image, RectangleF rect) throws InvalidImageRefException, LicenseException
Crops out the given rectangle from the image.- Parameters:
image- The image to crop.rect- The rectangle in normalized coordinates to crop.- Returns:
- Cropped image.
- Throws:
InvalidImageRefException- If an invalid image reference is usedLicenseException- If license requirements for the API are not met
-
rotate
public ImageRef rotate(ImageRef image, ImageRotation rotation) throws InvalidImageRefException, LicenseException
Rotates the given image by the given angle.- Parameters:
image- The image to rotaterotation- Rotation to be applied- Returns:
- Rotated image.
- Throws:
InvalidImageRefException- If an invalid image reference is usedLicenseException- If license requirements for the API are not met
-
flip
public ImageRef flip(ImageRef image, ImageOrigin origin) throws InvalidImageRefException, LicenseException
Flips the given image horizontally or vertically.- Parameters:
image- The image to fliporigin- Location of the image origin in the image coordinate system.- Returns:
- The result of the filter application.
- Throws:
InvalidImageRefException- If an invalid image reference is usedLicenseException- If license requirements for the API are not met
-
resize
public ImageRef resize(ImageRef image, int size) throws InvalidImageRefException, LicenseException
Resizes the given image to the given size.- Parameters:
image- The image to resizesize- Size of the longer side of the image.- Returns:
- Resized image.
- Throws:
InvalidImageRefException- If an invalid image reference is usedLicenseException- If license requirements for the API are not met
-
close
public void close()
Closes native resources held by the object.- Specified by:
closein interfacejava.lang.AutoCloseable
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
-