ImageData
The ImageData class represents image data, which contains the image bytes, width, height, stride, pixel format, orientation and a tag.
Definition
Namespace: com.dynamsoft.core.basic_structures
Assembly: DynamsoftCaptureVisionBundle.aar
class ImageData
Attributes
| Attributes | Type | Description |
|---|---|---|
bytes |
byte[] | The image data content in a byte array. |
width |
int | The width of the image in pixels. |
height |
int | The height of the image in pixels. |
stride |
int | The stride (or scan width) of the image. |
format |
int | The image pixel format used in the image byte array. |
orientation |
int | The orientation information of the image. The library is able to read the orientation information from the EXIF data of the image file. |
tag |
ImageTag | The tag of the image. |
Methods
| Method | Description |
|---|---|
ImageData |
The constructor. |
toBitmap |
Transform the ImageData to an android.graphics.Bitmap. |
fromBitmap |
Convert an android.graphics.Bitmap to an ImageData. |
toString |
Transform the ImageData to a string. |
bytes
The image data content in a byte array.
byte[] bytes;
width
The width of the image in pixels.
int width;
height
The height of the image in pixels.
int height;
stride
The stride (or scan width) of the image.
int stride;
format
The image pixel format used in the image byte array.
@EnumImagePixelFormat
int format;
Related APIs:
orientation
The orientation information of the image. The library is able to read the orientation information from the EXIF data of the image file.
int orientation;
tag
The tag of the image.
ImageTag imageTag;
ImageData
The constructor.
ImageData();
toBitmap
Transform the ImageData to a android.graphics.Bitmap.
Bitmap toBitmap() throws CoreException;
Exception
| Error Code | Value | Description |
|---|---|---|
| EC_BPP_NOT_SUPPORTED | -10007 | The pixel format is not supported or the ImageData is invalid. |
Return Value
An android.graphics.Bitmap that converted from the ImageData.
fromBitmap
Convert an android.graphics.Bitmap to an ImageData.
static ImageData fromBitmap(Bitmap bitmap);
toString
Transform the ImageData to a string.
String toString();
Return Value
A String that converted from the ImageData.