Is there a way to load image as bitmap to Glide

后端 未结 11 1451
温柔的废话
温柔的废话 2020-12-04 19:35

Im looking for a way to use bitmap as input to Glide. I am even not sure if its possible. It\'s for resizing purposes. Glide has a good image enhancement with scale. The pro

11条回答
  •  借酒劲吻你
    2020-12-04 20:12

    Most of the API's and methods of Glide are now deprecated. Below is working for Glide 4.9 and upto Android 10.

    For image URI

      Bitmap bitmap = Glide
        .with(context)
        .asBitmap()
        .load(image_uri_or_drawable_resource_or_file_path)
        .submit()
        .get();
    

    Use Glide as below in build.gradle

    implementation 'com.github.bumptech.glide:glide:4.9.0'
    

提交回复
热议问题