public class BitmapUtils
Contains convenient methods for Bitmaps
public static BitmapUtils INSTANCE
Contains convenient methods for Bitmaps
@JvmStatic
@NotNull
public static android.graphics.Rect getBitmapBounds(@Nullable
java.lang.String path)
@JvmStatic
public static boolean isBitmapValid(@Nullable
android.graphics.Bitmap bitmap)
true if Bitmap valid (and can be drawed). false
otherwise.@JvmStatic
@NotNull
public static android.graphics.Rect getContentBounds(@Nullable
android.graphics.Bitmap bitmap)
NullPointerException - if Bitmap is null@JvmStatic
public static void compress(@NotNull
android.graphics.Bitmap bitmap,
@Nullable
android.graphics.Bitmap.CompressFormat format,
int quality,
@Nullable
java.io.File file)
Compresses Bitmap to File
@JvmStatic
@Nullable
public static android.graphics.Bitmap createPreview(@Nullable
android.content.res.Resources res,
int imageRes,
int targetWidth,
int targetHeight)
Create preview from large (nodpi) resource image
res - ResourcesimageRes - image resource idtargetWidth - target widthtargetHeight - target height@JvmStatic
@Nullable
public static android.graphics.Bitmap createPreview(@Nullable
kotlin.Array[] image,
int targetWidth,
int targetHeight)
Create preview from image byte array
image - image byte arraytargetWidth - target widthtargetHeight - target height@JvmStatic
@Nullable
public static android.graphics.Bitmap createPreview(@Nullable
android.graphics.Bitmap image,
int targetWidth,
int targetHeight)
Create preview from image byte array
image - image BitmaptargetWidth - target widthtargetHeight - target height@JvmStatic
public static int calculateInSampleSize(@NotNull
android.graphics.BitmapFactory.Options options,
int reqWidth,
int reqHeight)
Calculates best inSampleSize to fit reqWidth and reqHeight or a bit more
options - reqWidth - reqHeight - @JvmStatic
@Nullable
public static android.graphics.Bitmap decodeQuietly(@Nullable
java.lang.String path,
@Nullable
android.graphics.BitmapFactory.Options options)
Decodes Bitmap with minimal log output. Accepts null
arguments.
null if load failed.@JvmStatic
@Nullable
public static android.graphics.Bitmap drawableToBitmap(@NotNull
android.graphics.drawable.Drawable drawable)
Converts image drawable to bitmap
drawable - @JvmStatic
@NotNull
public static android.graphics.Bitmap scaleIfNeeded(@NotNull
android.graphics.Bitmap image,
int maxHeight,
int maxWidth)
Scales bitmap with saved aspectRatio