Class BitmapConverter

java.lang.Object
mil.nga.geopackage.io.BitmapConverter

public class BitmapConverter extends Object
Conversions between Bitmaps and image bytes
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static android.graphics.Bitmap
    toBitmap(byte[] bytes)
    Decode the bytes to a bitmap
    static android.graphics.Bitmap
    toBitmap(byte[] bytes, android.graphics.BitmapFactory.Options options)
    Decode the bytes to a bitmap, with options
    static byte[]
    toBytes(android.graphics.Bitmap bitmap, android.graphics.Bitmap.CompressFormat format)
    Compress the bitmap to a byte array at full quality
    static byte[]
    toBytes(android.graphics.Bitmap bitmap, android.graphics.Bitmap.CompressFormat format, int quality)
    Compress the bitmap to a byte array

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BitmapConverter

      public BitmapConverter()
  • Method Details

    • toBitmap

      public static android.graphics.Bitmap toBitmap(byte[] bytes)
      Decode the bytes to a bitmap
      Parameters:
      bytes - image bytes
      Returns:
      image bitmap
    • toBitmap

      public static android.graphics.Bitmap toBitmap(byte[] bytes, android.graphics.BitmapFactory.Options options)
      Decode the bytes to a bitmap, with options
      Parameters:
      bytes - image bytes
      options - decode options
      Returns:
      image bitmap
    • toBytes

      public static byte[] toBytes(android.graphics.Bitmap bitmap, android.graphics.Bitmap.CompressFormat format) throws IOException
      Compress the bitmap to a byte array at full quality
      Parameters:
      bitmap - image bitmap
      format - compress format
      Returns:
      image bytes
      Throws:
      IOException - upon failure
    • toBytes

      public static byte[] toBytes(android.graphics.Bitmap bitmap, android.graphics.Bitmap.CompressFormat format, int quality) throws IOException
      Compress the bitmap to a byte array
      Parameters:
      bitmap - bitmap image
      format - compress format
      quality - quality
      Returns:
      image bytes
      Throws:
      IOException - upon failure