Back to Fresco

BitmapUtil

docs/javadoc/reference/com/facebook/imageutils/BitmapUtil.html

3.6.015.1 KB
Original Source

Fresco

|

|

Packages | Classes

Classes

Packages | Classes

Summary: Constants | Ctors | Methods | Inherited Methods | [Expand All]

public final class

BitmapUtil

extends Object

| java.lang.Object | | ↳ | com.facebook.imageutils.BitmapUtil |

Class Overview

This class contains utility method for Bitmap

Summary

Constants
int
int
int
float
int
int
Public Constructors
Public Methods
static Pair<Integer, Integer>
Decodes the bounds of an image from its Uri and returns a pair of the dimensions
static Pair<Integer, Integer>
Decodes only the bounds of an image and returns its width and height or null if the size can't be determined
static Pair<Integer, Integer>
Decodes the bounds of an image and returns its width and height or null if the size can't be determined
static ImageMetaData
Decodes the bounds of an image and returns its width and height or null if the size can't be determined.
static int
Returns the amount of bytes used by a pixel in a specific android.graphics.Bitmap.Config
static int
Returns the size in byte of an image with specific size and android.graphics.Bitmap.Config
static int

| [Expand] Inherited Methods | | --- | | From class java.lang.Object

| Object | clone() | | boolean | equals(Object arg0) | | void | finalize() | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |

|

Constants

public static final int ALPHA_8_BYTES_PER_PIXEL

Bytes per pixel definitions

Constant Value: 1 (0x00000001)

public static final int ARGB_4444_BYTES_PER_PIXEL

Constant Value: 2 (0x00000002)

public static final int ARGB_8888_BYTES_PER_PIXEL

Constant Value: 4 (0x00000004)

public static final float MAX_BITMAP_SIZE

Constant Value: 2048.0

public static final int RGBA_F16_BYTES_PER_PIXEL

Constant Value: 8 (0x00000008)

public static final int RGB_565_BYTES_PER_PIXEL

Constant Value: 2 (0x00000002)

Public Constructors

public BitmapUtil()

Public Methods

public static Pair<Integer, Integer> decodeDimensions(Uri uri)

Decodes the bounds of an image from its Uri and returns a pair of the dimensions

Parameters

| uri | the Uri of the image |

Returns
  • dimensions of the image

public static Pair<Integer, Integer> decodeDimensions(byte[] bytes)

Decodes only the bounds of an image and returns its width and height or null if the size can't be determined

Parameters

| bytes | the input byte array of the image |

Returns
  • dimensions of the image

public static Pair<Integer, Integer> decodeDimensions(InputStream is)

Decodes the bounds of an image and returns its width and height or null if the size can't be determined

Parameters

| is | the InputStream containing the image data |

Returns
  • dimensions of the image

public static ImageMetaData decodeDimensionsAndColorSpace(InputStream is)

Decodes the bounds of an image and returns its width and height or null if the size can't be determined. It also recovers the color space of the image, or null if it can't be determined.

Parameters

| is | the InputStream containing the image data |

Returns
  • the metadata of the image

public static int getPixelSizeForBitmapConfig(Bitmap.Config bitmapConfig)

Returns the amount of bytes used by a pixel in a specific android.graphics.Bitmap.Config

Parameters

| bitmapConfig | the android.graphics.Bitmap.Config for which the size in byte will be returned |

public static int getSizeInByteForBitmap(int width, int height, Bitmap.Config bitmapConfig)

Returns the size in byte of an image with specific size and android.graphics.Bitmap.Config

Parameters

| width | the width of the image | | height | the height of the image | | bitmapConfig | the android.graphics.Bitmap.Config for which the size in byte will be returned |

public static int getSizeInBytes(Bitmap bitmap)

Returns
  • size in bytes of the underlying bitmap

+Generated by Doclava. +