public class ImageUtils
extends java.lang.Object
bitmapToByte(Bitmap)bitmapToDrawable(Bitmap)byteToBitmap(byte[])byteToDrawable(byte[])drawableToBitmap(Drawable)drawableToByte(Drawable)| Constructor and Description |
|---|
ImageUtils() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
bitmapToByte(Bitmap b)
convert Bitmap to byte array
|
static Drawable |
bitmapToDrawable(Bitmap b)
convert Bitmap to Drawable
|
static Bitmap |
byteToBitmap(byte[] b)
convert byte array to Bitmap
|
static Drawable |
byteToDrawable(byte[] b)
convert byte array to Drawable
|
static Bitmap |
drawableToBitmap(Drawable d)
convert Drawable to Bitmap
|
static byte[] |
drawableToByte(Drawable d)
convert Drawable to byte array
|
static Bitmap |
getBitmapFromUrl(java.lang.String imageUrl,
int readTimeOut)
get Bitmap by imageUrl
|
static Bitmap |
getBitmapFromUrl(java.lang.String imageUrl,
int readTimeOut,
java.util.Map<java.lang.String,java.lang.String> requestProperties)
get Bitmap by imageUrl
|
static Drawable |
getDrawableFromUrl(java.lang.String imageUrl,
int readTimeOutMillis)
get drawable by imageUrl
|
static Drawable |
getDrawableFromUrl(java.lang.String imageUrl,
int readTimeOutMillis,
java.util.Map<java.lang.String,java.lang.String> requestProperties)
get drawable by imageUrl
|
static java.io.InputStream |
getInputStreamFromUrl(java.lang.String imageUrl,
int readTimeOutMillis)
get input stream from network by imageurl, you need to close inputStream yourself
|
static java.io.InputStream |
getInputStreamFromUrl(java.lang.String imageUrl,
int readTimeOutMillis,
java.util.Map<java.lang.String,java.lang.String> requestProperties)
get input stream from network by imageurl, you need to close inputStream yourself
|
static Bitmap |
scaleImage(Bitmap org,
float scaleWidth,
float scaleHeight)
scale image
|
static Bitmap |
scaleImageTo(Bitmap org,
int newWidth,
int newHeight)
scale image
|
public static byte[] bitmapToByte(Bitmap b)
b - public static Bitmap byteToBitmap(byte[] b)
b - public static Bitmap drawableToBitmap(Drawable d)
d - public static Drawable bitmapToDrawable(Bitmap b)
b - public static byte[] drawableToByte(Drawable d)
d - public static Drawable byteToDrawable(byte[] b)
b - public static java.io.InputStream getInputStreamFromUrl(java.lang.String imageUrl,
int readTimeOutMillis)
imageUrl - readTimeOutMillis - ImageUtils#getInputStreamFromUrl(String, int, boolean)public static java.io.InputStream getInputStreamFromUrl(java.lang.String imageUrl,
int readTimeOutMillis,
java.util.Map<java.lang.String,java.lang.String> requestProperties)
imageUrl - readTimeOutMillis - read time out, if less than 0, not set, in millsrequestProperties - http request propertiesjava.net.MalformedURLExceptionjava.io.IOExceptionpublic static Drawable getDrawableFromUrl(java.lang.String imageUrl,
int readTimeOutMillis)
imageUrl - readTimeOutMillis - ImageUtils#getDrawableFromUrl(String, int, boolean)public static Drawable getDrawableFromUrl(java.lang.String imageUrl,
int readTimeOutMillis,
java.util.Map<java.lang.String,java.lang.String> requestProperties)
imageUrl - readTimeOutMillis - read time out, if less than 0, not set, in millsrequestProperties - http request propertiespublic static Bitmap getBitmapFromUrl(java.lang.String imageUrl,
int readTimeOut)
imageUrl - readTimeOut - ImageUtils#getBitmapFromUrl(String, int, boolean)public static Bitmap getBitmapFromUrl(java.lang.String imageUrl,
int readTimeOut,
java.util.Map<java.lang.String,java.lang.String> requestProperties)
imageUrl - requestProperties - http request propertiespublic static Bitmap scaleImageTo(Bitmap org,
int newWidth,
int newHeight)
org - newWidth - newHeight - public static Bitmap scaleImage(Bitmap org,
float scaleWidth,
float scaleHeight)
org - scaleWidth - sacle of widthscaleHeight - scale of height