Image class

Represents an image.

Implemented types

Constructors

Image()
Creates a new instance of the Image class.
Image.fromHandle(Pointer<id3FaceImage> handle)
Creates a new instance of the Image class.

Properties

data Uint8List
Raw data buffer of the image.
no setter
handle Pointer<id3FaceImage>
Gets the native handle. return The native handle.
no setter
hashCode int
The hash code for this object.
no setterinherited
height int
Height in pixels.
no setter
pixelDepth int
Pixel depth.
no setter
pixelFormat PixelFormat
Pixel format.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stride int
Stride in bytes.
no setter
width int
Width in pixels.
no setter

Methods

clone() Image
Creates a copy of the Image object.
compare(Image cmpImage) double
Computes the difference with another image.
correctGamma(int contrast, int brightness, double gamma) → void
Applies a gamma correction to the image.
crop(int left, int top, int width, int height) Image
Crop a rectangular region of interest in the image according to the given bounds.
dispose() → void
Releases all resources used by this Image.
downscale(int maxSize) double
Downscales the image in-place so that its maximum dimension is equal to the given maximum size, while preserving the aspect ratio. Note: If the maximum dimension is already smaller than the given maximum size, the function does nothing and the scaling ration returned is 1.
downscaleTo(Image dstImage, int maxSize) double
Downscales the image so that its maximum dimension equals the given maximum size, while preserving the aspect ratio. Note: If the maximum dimension is already smaller than the given maximum size, the function does nothing and the returned scale ratio is 1.
extractRoi(Rectangle bounds) Image
Extracts a region of interest in the image according to the given bounds.
extractRoiWithColor(Rectangle bounds, int colorRed, int colorGreen, int colorBlue) Image
Extracts a region of interest in the image according to the given bounds.
flip(bool flipHorizontally, bool flipVertically) → void
Flips the image in-place.
flipTo(bool flipHorizontally, bool flipVertically, Image dstImage) → void
Flips the image.
getData() Uint8List
Gets the raw data buffer of the image.
getHeight() int
Gets the height in pixels.
getPixelDepth() int
Gets the pixel depth.
getPixelFormat() PixelFormat
Gets the pixel format.
getStride() int
Gets the stride in bytes.
getWidth() int
Gets the width in pixels.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pad(int top, int left, int bottom, int right, int colorRed, int colorGreen, int colorBlue) → void
Add padding around the image Only works for BGR 24 bits, RGB 24 bits and Grayscale 8bits images. For grayscale image, the padding color is the red component.
reallocate(int width, int height, PixelFormat pixelFormat) → void
Reallocates the internal memory of the Image from parameters. Note: If the given parameters are the same as the ones of the object, then there is nothing done in this function.
resize(int width, int height) → void
Resizes the image in-place to the required width and height.
resizeTo(int width, int height, Image dstImage) → void
Resizes the image to the specified width and height.
rotate(int angle) → void
Rotates the image in-place to the specified angle. Note: The rotation is performed counter-clockwise.
rotateTo(int angle, Image dstImage) → void
Rotates the image to the specified angle. Note: The rotation is performed counter-clockwise.
toBuffer(ImageFormat imageFormat, double compressionLevel) Uint8List
Exports the image to a buffer. The compression level meaning depends on the algorithm used:
toBufferObject(ImageFormat imageFormat, double compressionLevel, ImageBuffer buffer) → void
Copies the image to a buffer in the specified format. The compression level meaning depends on the algorithm used:
toFile(String? filepath, double compressionLevel) → void
Saves the image to the specified file. The compression level meaning depends on the algorithm used:
toRawBuffer(PixelFormat pixelFormat, ImageBuffer buffer) → void
Copies image pixels in the specified format into a buffer.
toString() String
A string representation of this object.
inherited
transpose() → void
Transposes the image object.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromBuffer(Uint8List? data, PixelFormat pixelFormat) Image
Creates an Image from the specified data buffer.
fromFile(String? filepath, PixelFormat pixelFormat) Image
Creates an Image from the specified file.
fromRawBuffer(Uint8List? pixels, int width, int height, int stride, PixelFormat srcPixelFormat, PixelFormat dstPixelFormat) Image
Creates an Image from the specified raw data buffer.
fromYuvPlanes(Uint8List? yPlane, Uint8List? uPlane, Uint8List? vPlane, int yWidth, int yHeight, int uvPixelStride, int uvRowStride, PixelFormat dstPixelFormat) Image
Creates an Image from the specified YUV planes.