Package io.scanbot.sdk.util.bitmap
Object BitmapUtils
-
- All Implemented Interfaces:
public class BitmapUtils
Contains convenient methods for Bitmaps.
-
-
Field Summary
Fields Modifier and Type Field Description public final static BitmapUtils
INSTANCE
-
Method Summary
Modifier and Type Method Description final static Rect
getBitmapBounds(String path)
final static Boolean
isBitmapValid(Bitmap bitmap)
final static Rect
getContentBounds(Bitmap bitmap)
final static Bitmap
createPreview(Resources res, Integer imageRes, Integer targetWidth, Integer targetHeight)
Create preview from large (nodpi) resource image final static Bitmap
createPreview(ByteArray image, Integer targetWidth, Integer targetHeight)
Create preview from image byte array final static Bitmap
createPreview(Bitmap image, Integer targetWidth, Integer targetHeight)
Create preview from image byte array final static Integer
calculateInSampleSize(BitmapFactory.Options options, Integer reqWidth, Integer reqHeight)
Calculates best inSampleSize to fit reqWidth and reqHeight or a bit more final static Bitmap
decodeQuietly(String path, BitmapFactory.Options options)
Decodes Bitmap with minimal log output. final static Bitmap
drawableToBitmap(Drawable drawable)
Converts image drawable to Bitmap. final static Bitmap
scaleIfNeeded(Bitmap image, Integer maxHeight, Integer maxWidth)
Scales bitmap with saved aspectRatio -
-
Method Detail
-
getBitmapBounds
final static Rect getBitmapBounds(String path)
-
isBitmapValid
final static Boolean isBitmapValid(Bitmap bitmap)
-
getContentBounds
final static Rect getContentBounds(Bitmap bitmap)
-
createPreview
final static Bitmap createPreview(Resources res, Integer imageRes, Integer targetWidth, Integer targetHeight)
Create preview from large (nodpi) resource image
- Parameters:
res
- ResourcesimageRes
- image resource idtargetWidth
- target widthtargetHeight
- target height
-
createPreview
final static Bitmap createPreview(ByteArray image, Integer targetWidth, Integer targetHeight)
Create preview from image byte array
- Parameters:
image
- image byte arraytargetWidth
- target widthtargetHeight
- target height
-
createPreview
final static Bitmap createPreview(Bitmap image, Integer targetWidth, Integer targetHeight)
Create preview from image byte array
- Parameters:
image
- image BitmaptargetWidth
- target widthtargetHeight
- target height
-
calculateInSampleSize
final static Integer calculateInSampleSize(BitmapFactory.Options options, Integer reqWidth, Integer reqHeight)
Calculates best inSampleSize to fit reqWidth and reqHeight or a bit more
-
decodeQuietly
final static Bitmap decodeQuietly(String path, BitmapFactory.Options options)
Decodes Bitmap with minimal log output. Accepts
null
arguments.
-
drawableToBitmap
final static Bitmap drawableToBitmap(Drawable drawable)
Converts image drawable to Bitmap.
-
scaleIfNeeded
final static Bitmap scaleIfNeeded(Bitmap image, Integer maxHeight, Integer maxWidth)
Scales bitmap with saved aspectRatio
-
-
-
-