Class BitmapUtils

java.lang.Object
com.digimarc.capture.camera.BitmapUtils

public class BitmapUtils extends Object
This class provides a series of utility methods for handling camera frames. These methods can be used for converting, rotating and scaling the image data returned in ReaderResult objects.
  • Constructor Details

    • BitmapUtils

      public BitmapUtils()
  • Method Details

    • createScaledBitmap

      @Nullable public static android.graphics.Bitmap createScaledBitmap(@NonNull android.graphics.Bitmap unscaledBitmap, int dstWidth, int dstHeight, @NonNull BitmapUtils.SCALING_LOGIC scalingLogic)
      Create a scaled version of the supplied bitmap
      Parameters:
      unscaledBitmap - Source bitmap image
      dstWidth - Requested width for the scaled bitmap
      dstHeight - Requested height for the scaled bitmap
      scalingLogic - How should the scaling be performed.
      Returns:
      A new bitmap matching the supplied size parameters, or null if the operation failed.
    • rotateBitmap

      @Nullable public static android.graphics.Bitmap rotateBitmap(@NonNull android.graphics.Bitmap sourceBitmap, float degree)
      Rotate the supplied bitmap.
      Parameters:
      sourceBitmap - Bitmap
      degree - Rotation degrees
      Returns:
      Rotated bitmap or null if the operation failed.
    • convertRawImageToBitmap

      @Nullable public static android.graphics.Bitmap convertRawImageToBitmap(@NonNull ImageFrame frame)
      Convert the supplied image into a bitmap. The bitmap will have the same dimensions as provided image frame.
      Parameters:
      frame - Image data.
      Returns:
      A bitmap object.
    • convertRawImageToBitmap

      @Nullable public static android.graphics.Bitmap convertRawImageToBitmap(@NonNull ImageFrame frame, int surfaceRotation)
      Convert the supplied image into a bitmap. The converted image will be rotated according to the surfaceRotation parameter. The bitmap will have the same dimensions as provided image frame.
      Parameters:
      frame - Image data.
      surfaceRotation - Image rotation.
      Returns:
      A bitmap object.