Is there a way to load image as bitmap to Glide

后端 未结 11 1452
温柔的废话
温柔的废话 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:08

    A really strange case, but lets try to solve it. I'm using the old and not cool Picasso, but one day I'll give Glide a try. Here are some links that could help you :

    • Bitmap POC
    • Supporting bitmaps topic
    • Someone also facing your problem

    And actually a cruel but I think efficient way to solve this :

    ByteArrayOutputStream stream = new ByteArrayOutputStream();
      yourBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
      Glide.with(this)
          .load(stream.toByteArray())
          .asBitmap()
          .error(R.drawable.ic_thumb_placeholder)
          .transform(new CircleTransform(this))
          .into(imageview);
    

    I'm not sure if this will help you, but I hope it can make you a step closer to the solution.

提交回复
热议问题