Package io.scanbot.sdk.process
Class ImageProcessor
-
- All Implemented Interfaces:
-
io.scanbot.sdk.dispose.Disposable
public final class ImageProcessor implements Disposable
Class for applying chains of image processing operations.
-
-
Constructor Summary
Constructors Constructor Description ImageProcessor(Bitmap bitmap)
ImageProcessor(ByteArray nv21, Integer width, Integer height, ImageRotation orientation)
ImageProcessor(ByteArray jpeg)
ImageProcessor(String imagePath)
ImageProcessor(ImageRef imageRef)
ImageProcessor()
-
Method Summary
Modifier and Type Method Description Unit
dispose()
Calling this method will clear native buffer for ImageProcessor. final ImageProcessor
applyFilter(ParametricFilter filter)
Applies filter to the image. final ImageProcessor
applyFilter(ImageRef imageRef, ParametricFilter filter)
Applies filter to the image. final ImageProcessor
crop(List<PointF> polygon)
Crops the image to the given polygon. final ImageProcessor
crop(ImageRef imageRef, List<PointF> polygon)
Crops the image to the given polygon. final ImageProcessor
rotate(ImageRotation rotation)
Rotates the given image. final ImageProcessor
rotate(ImageRef imageRef, ImageRotation rotation)
Rotates the given image. final ImageProcessor
rotate(Integer degrees)
Rotates the given image clockwise. final ImageProcessor
rotate(ImageRef imageRef, Integer degrees)
Rotates the given image clockwise. final ImageProcessor
resize(Integer maxSize)
Resizes image to the given size. final ImageProcessor
resize(ImageRef imageRef, Integer maxSize)
Resizes image to the given size. final Bitmap
processedBitmap()
Returns processed image. final ByteArray
encodedProcessedImage(EncodeImageOptions encodeImageOptions)
Returns encoded processed image as ByteArray. final Boolean
saveProcessedImage(String path, SaveImageOptions saveImageOptions)
Saves processed image to the given path. -
-
Constructor Detail
-
ImageProcessor
ImageProcessor(Bitmap bitmap)
-
ImageProcessor
ImageProcessor(ByteArray nv21, Integer width, Integer height, ImageRotation orientation)
-
ImageProcessor
ImageProcessor(ByteArray jpeg)
-
ImageProcessor
ImageProcessor(String imagePath)
-
ImageProcessor
ImageProcessor(ImageRef imageRef)
-
ImageProcessor
ImageProcessor()
-
-
Method Detail
-
dispose
Unit dispose()
Calling this method will clear native buffer for ImageProcessor. It will be recreated if it will be called again
-
applyFilter
final ImageProcessor applyFilter(ParametricFilter filter)
Applies filter to the image.
- Parameters:
filter
- filter to apply
-
applyFilter
final ImageProcessor applyFilter(ImageRef imageRef, ParametricFilter filter)
Applies filter to the image.
- Parameters:
imageRef
- image to apply filterfilter
- filter to apply
-
crop
final ImageProcessor crop(List<PointF> polygon)
Crops the image to the given polygon.
- Parameters:
polygon
- polygon to crop
-
crop
final ImageProcessor crop(ImageRef imageRef, List<PointF> polygon)
Crops the image to the given polygon.
- Parameters:
imageRef
- image to croppolygon
- polygon to crop
-
rotate
final ImageProcessor rotate(ImageRotation rotation)
Rotates the given image.
- Parameters:
rotation
- one of ImageRotation are supported
-
rotate
final ImageProcessor rotate(ImageRef imageRef, ImageRotation rotation)
Rotates the given image.
- Parameters:
imageRef
- image to rotaterotation
- one of ImageRotation are supported
-
rotate
final ImageProcessor rotate(Integer degrees)
Rotates the given image clockwise.
- Parameters:
degrees
- 0, 90, 180, 270 are supported
-
rotate
final ImageProcessor rotate(ImageRef imageRef, Integer degrees)
Rotates the given image clockwise.
- Parameters:
imageRef
- image to rotatedegrees
- 0, 90, 180, 270 are supported
-
resize
final ImageProcessor resize(Integer maxSize)
Resizes image to the given size.
- Parameters:
maxSize
- max size of the image
-
resize
final ImageProcessor resize(ImageRef imageRef, Integer maxSize)
Resizes image to the given size.
- Parameters:
imageRef
- image to resizemaxSize
- max size of the image
-
processedBitmap
final Bitmap processedBitmap()
Returns processed image.
-
encodedProcessedImage
final ByteArray encodedProcessedImage(EncodeImageOptions encodeImageOptions)
Returns encoded processed image as ByteArray.
- Parameters:
encodeImageOptions
- options for encoding image.
-
saveProcessedImage
final Boolean saveProcessedImage(String path, SaveImageOptions saveImageOptions)
Saves processed image to the given path.
- Parameters:
path
- path to save imagesaveImageOptions
- options for saving image.
-
-
-
-