Package com.microblink.blinkid.image

# Class Image

java.lang.Object
com.microblink.blinkid.image.Image

All Implemented Interfaces:
  `android.os.Parcelable`

public class Image extends Object implements android.os.Parcelable
Represents a image that is being processed.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface android.os.Parcelable

  `android.os.Parcelable.ClassLoaderCreator<T extends Object>, android.os.Parcelable.Creator<T extends Object>`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final android.os.Parcelable.Creator<Image>`
  `CREATOR`

  ### Fields inherited from interface android.os.Parcelable

  `CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `Image(android.os.Parcel in)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Image`
  `clone()`
  Creates and returns a copy of this image object.
  `android.graphics.Bitmap`
  `convertToBitmap()`
  Converts this image into Android Bitmap.
  `int`
  `describeContents()`
  `void`
  `dispose()`
  Disposes native object containing image pixels.
  `protected void`
  `finalize()`
  `ByteBuffer`
  `getBuffer()`
  Returns the native buffer that contains image pixels.
  `int`
  `getHeight()`
  Returns the height of the image (corrected for the current orientation).
  `ImageFormat`
  `getImageFormat()`
  Returns the format of the image.
  `String`
  `getImageName()`
  Deprecated.
  Do not rely on this information anymore.
  `Orientation`
  `getImageOrientation()`
  Returns the orientation of the image.
  `int`
  `getPixelStride()`
  Returns the pixel stride for image buffer.
  `int`
  `getRawHeight()`
  Returns the raw height of the image (uncorrected for the orientation)
  `int`
  `getRawWidth()`
  Returns the raw width of the image (uncorrected for the orientation)
  `int`
  `getRowStride()`
  Returns the row stride for image buffer.
  `int`
  `getWidth()`
  Returns the width of the image (corrected for the current orientation).
  `boolean`
  `isDisposed()`
  Returns true if image's internal buffers are disposed and cannot be used anymore.
  `void`
  `setImageOrientation(Orientation orientation)`
  Use this method to change Image's orientation.
  `InputImage`
  `toInputImage()`
  `void`
  `writeToParcel(android.os.Parcel dest, int flags)`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### CREATOR

    @NonNull public static final android.os.Parcelable.Creator<Image> CREATOR

- ## Constructor Details

  - ### Image

    protected Image(@NonNull android.os.Parcel in)

- ## Method Details

  - ### dispose

    public void dispose()
    Disposes native object containing image pixels. After this method is called, Image object cannot be used anymore.

  - ### finalize

    protected void finalize() throws Throwable
    Overrides:
      `finalize` in class `Object`
    Throws:
      `Throwable`

  - ### clone

    @NonNull public Image clone()
    Creates and returns a copy of this image object. This method makes a copy of image pixels. Use it if you want to use this image for later processing.
    Overrides:
      `clone` in class `Object`
    Returns:
      a copy of this image object

  - ### getWidth

    public int getWidth()
    Returns the width of the image (corrected for the current orientation).
    Returns:
      the width of the image (corrected for the current orientation).

  - ### getRawWidth

    public int getRawWidth()
    Returns the raw width of the image (uncorrected for the orientation)

  - ### getHeight

    public int getHeight()
    Returns the height of the image (corrected for the current orientation).
    Returns:
      the height of the image (corrected for the current orientation).

  - ### getRawHeight

    public int getRawHeight()
    Returns the raw height of the image (uncorrected for the orientation)

  - ### getImageFormat

    @NonNull public ImageFormat getImageFormat()
    Returns the format of the image.
    Returns:
      the format of the image.

  - ### getImageName

    @NonNull @Deprecated public String getImageName()
    Deprecated.
    Do not rely on this information anymore. New API images will be nameless.
    Returns the name of the image.
    Returns:
      the name of the image.

  - ### getBuffer

    @NonNull public ByteBuffer getBuffer()
    Returns the native buffer that contains image pixels.
    Returns:
      the native buffer that contains image pixels.

  - ### getPixelStride

    public int getPixelStride()
    Returns the pixel stride for image buffer. Pixel stride is byte difference between two consecutive pixels image row. It is guaranteed that pixel stride is at least 1.
    Returns:
      the pixel stride for image buffer.

  - ### getRowStride

    public int getRowStride()
    Returns the row stride for image buffer. Row stride is byte difference between two consecutive rows in image.
    Returns:
      the row stride for image plane

  - ### getImageOrientation

    @NonNull public Orientation getImageOrientation()
    Returns the orientation of the image. Orientation is defined as orientation of the device when the image was taken. To explain the orientation further, let's assume that image contains a line of text. If orientation is Orientation.ORIENTATION_LANDSCAPE_RIGHT, the line of text would be horizontal from left to right (normal reading orientation). If orientation is Orientation.ORIENTATION_PORTRAIT, the line of text would be vertical from bottom to top. In order to read the text, you would need to rotate image by 90 degrees clockwise. If orientation is Orientation.ORIENTATION_PORTRAIT_UPSIDE, the line of text would be vertical from top to bottom. In order to read the text, you would need to rotate image by 90 degrees counterclockwise. If orientation is Orientation.ORIENTATION_LANDSCAPE_LEFT, the line of text would be horizontal from right to left (upside down). In order to read the text, you would need to rotate image by 180 degrees.
    Returns:
      the orientation of the image

  - ### setImageOrientation

    public void setImageOrientation(@NonNull Orientation orientation)
    Use this method to change Image's orientation. This can be useful for different interpretations of same image in different recognition contexts.
    Parameters:
      `orientation` -

  - ### isDisposed

    public boolean isDisposed()
    Returns true if image's internal buffers are disposed and cannot be used anymore.
    Returns:
      true if image's internal buffers are disposed and cannot be used anymore.

  - ### convertToBitmap

    @Nullable public android.graphics.Bitmap convertToBitmap()
    Converts this image into Android Bitmap. This is a very slow process that involves copying and converting a lot of data. Returned bitmap has its own pixel buffer, so it may remain valid even after this image's buffers become invalid (i.e. after image gets disposed).
    Returns:
      Image converted to Android Bitmap or null if conversion failed.

  - ### describeContents

    public int describeContents()
    Specified by:
      `describeContents` in interface `android.os.Parcelable`

  - ### writeToParcel

    public void writeToParcel(@NonNull android.os.Parcel dest, int flags)
    Specified by:
      `writeToParcel` in interface `android.os.Parcelable`

  - ### toInputImage

    public InputImage toInputImage()