Class BitmapConverter

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

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

    • BitmapConverter

      public BitmapConverter()
  • Method Details

    • toBitmap

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

      public static Bitmap toBitmap(byte[] bytes, 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(Bitmap bitmap, 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(Bitmap bitmap, 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