Package io.scanbot.sdk.util.bitmap
Object BitmapUtils
-
- All Implemented Interfaces:
public class BitmapUtilsContains convenient methods for Bitmaps.
-
-
Field Summary
Fields Modifier and Type Field Description public final static BitmapUtilsINSTANCE
-
Method Summary
Modifier and Type Method Description final static RectgetBitmapBounds(String path)final static BooleanisBitmapValid(Bitmap bitmap)final static RectgetContentBounds(Bitmap bitmap)final static Unitcompress(Bitmap bitmap, Bitmap.CompressFormat format, Integer quality, File file)Compresses Bitmap to File final static BitmapcreatePreview(Resources res, Integer imageRes, Integer targetWidth, Integer targetHeight)Create preview from large (nodpi) resource image final static BitmapcreatePreview(ByteArray image, Integer targetWidth, Integer targetHeight)Create preview from image byte array final static BitmapcreatePreview(Bitmap image, Integer targetWidth, Integer targetHeight)Create preview from image byte array final static IntegercalculateInSampleSize(BitmapFactory.Options options, Integer reqWidth, Integer reqHeight)Calculates best inSampleSize to fit reqWidth and reqHeight or a bit more final static BitmapdecodeQuietly(String path, BitmapFactory.Options options)Decodes Bitmap with minimal log output. final static BitmapdrawableToBitmap(Drawable drawable)Converts image drawable to Bitmap. final static BitmapscaleIfNeeded(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)
-
compress
final static Unit compress(Bitmap bitmap, Bitmap.CompressFormat format, Integer quality, File file)
-
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
nullarguments.
-
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
-
-
-
-