-
public class BitmapUtilThis class contains utility method for Bitmap
-
-
Field Summary
Fields Modifier and Type Field Description private final IntegerALPHA_8_BYTES_PER_PIXELprivate final IntegerARGB_4444_BYTES_PER_PIXELprivate final IntegerARGB_8888_BYTES_PER_PIXELprivate final IntegerRGB_565_BYTES_PER_PIXELprivate final IntegerRGBA_F16_BYTES_PER_PIXELprivate final IntegerRGBA_1010102_BYTES_PER_PIXELprivate final FloatMAX_BITMAP_SIZEpublic final static BitmapUtilINSTANCE
-
Method Summary
Modifier and Type Method Description final static IntegergetSizeInBytes(Bitmap bitmap)final static Pair<Integer, Integer>decodeDimensions(ByteArray bytes)Decodes only the bounds of an image and returns its width and height or null if the size can't be determined final static Pair<Integer, Integer>decodeDimensions(Uri uri)Decodes the bounds of an image from its Uri and returns a pair of the dimensions final static Pair<Integer, Integer>decodeDimensions(InputStream inputStream)Decodes the bounds of an image and returns its width and height or null if the size can't be determined final static ImageMetaDatadecodeDimensionsAndColorSpace(InputStream inputStream)Decodes the bounds of an image and returns its width and height or null if the size can't be determined. final static IntegergetPixelSizeForBitmapConfig(Bitmap.Config bitmapConfig)Returns the amount of bytes used by a pixel in a specific [ ] final static IntegergetSizeInByteForBitmap(Integer width, Integer height, Bitmap.Config bitmapConfig)Returns the size in byte of an image with specific size and [ ] final static UnitsetUseDecodeBufferHelper(Boolean useDecodeBufferHelper)final IntegergetALPHA_8_BYTES_PER_PIXEL()Bytes per pixel definitions final IntegergetARGB_4444_BYTES_PER_PIXEL()final IntegergetARGB_8888_BYTES_PER_PIXEL()final IntegergetRGB_565_BYTES_PER_PIXEL()final IntegergetRGBA_F16_BYTES_PER_PIXEL()final IntegergetRGBA_1010102_BYTES_PER_PIXEL()final FloatgetMAX_BITMAP_SIZE()-
-
Method Detail
-
getSizeInBytes
final static Integer getSizeInBytes(Bitmap bitmap)
-
decodeDimensions
final static Pair<Integer, Integer> decodeDimensions(ByteArray 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
-
decodeDimensions
final 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
-
decodeDimensions
final static Pair<Integer, Integer> decodeDimensions(InputStream inputStream)
Decodes the bounds of an image and returns its width and height or null if the size can't be determined
- Parameters:
inputStream- the InputStream containing the image data
-
decodeDimensionsAndColorSpace
final static ImageMetaData decodeDimensionsAndColorSpace(InputStream inputStream)
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:
inputStream- the InputStream containing the image data
-
getPixelSizeForBitmapConfig
final static Integer getPixelSizeForBitmapConfig(Bitmap.Config bitmapConfig)
Returns the amount of bytes used by a pixel in a specific [ ]
- Parameters:
bitmapConfig- the android.graphics.Bitmap.Config for which the size in byte will be returned
-
getSizeInByteForBitmap
final static Integer getSizeInByteForBitmap(Integer width, Integer height, Bitmap.Config bitmapConfig)
Returns the size in byte of an image with specific size and [ ]
- Parameters:
width- the width of the imageheight- the height of the imagebitmapConfig- the android.graphics.Bitmap.Config for which the size in byte will be returned
-
setUseDecodeBufferHelper
final static Unit setUseDecodeBufferHelper(Boolean useDecodeBufferHelper)
-
getALPHA_8_BYTES_PER_PIXEL
final Integer getALPHA_8_BYTES_PER_PIXEL()
Bytes per pixel definitions
-
getARGB_4444_BYTES_PER_PIXEL
final Integer getARGB_4444_BYTES_PER_PIXEL()
-
getARGB_8888_BYTES_PER_PIXEL
final Integer getARGB_8888_BYTES_PER_PIXEL()
-
getRGB_565_BYTES_PER_PIXEL
final Integer getRGB_565_BYTES_PER_PIXEL()
-
getRGBA_F16_BYTES_PER_PIXEL
final Integer getRGBA_F16_BYTES_PER_PIXEL()
-
getRGBA_1010102_BYTES_PER_PIXEL
final Integer getRGBA_1010102_BYTES_PER_PIXEL()
-
getMAX_BITMAP_SIZE
final Float getMAX_BITMAP_SIZE()
-
-
-
-