Skip to content

Image Category

cesarferreira edited this page Oct 24, 2014 · 6 revisions

Image Utils

QuickUtils.image.__method__

Apply a blur to a Bitmap Bitmap

Returns a copy of the image with a blur

QuickUtils.image.blur(mBitmap, radius); // 0 <= radius <= 25

Don't forget to add this to your build.gradle:

 defaultConfig {
        ...
        renderscriptTargetApi 19
        renderscriptSupportMode true
}

dependencies {
    ...
    compile 'com.android.support:appcompat-v7:19.+'
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.android.support:support-v13:19.+'
}

Get a Bitmap by a given image URL void

QuickUtils.image.getBitmapByImageURL(imageURL, new OnEventListener<Bitmap>() {
  @Override
  public void onSuccess(Bitmap bitmap) {
    imageView.setImageBitmap(bitmap);
  }

  @Override
  public void onFailure(Exception e) {
    QuickUtils.system.toast("ERROR FETCHING IMAGE");
  }
});

Convert drawable to bitmap Bitmap

QuickUtils.image.convertDrawableToBitmap(drawable);

Convert drawable resource to bitmap Bitmap

QuickUtils.image.convertImageResourceToBitmap(context, R.id.imageBackground);