Android how to create runtime thumbnail

后端 未结 9 965
别那么骄傲
别那么骄傲 2020-11-27 09:59

I have a large sized image. At runtime, I want to read the image from storage and scale it so that its weight and size gets reduced and I can use it as a thumbnail. When a u

9条回答
  •  渐次进展
    2020-11-27 10:51

    If you want high quality result, so use [RapidDecoder][1] library. It is simple as follow:

    import rapid.decoder.BitmapDecoder;
    ...
    Bitmap bitmap = BitmapDecoder.from(getResources(), R.drawable.image)
                                 .scale(width, height)
                                 .useBuiltInDecoder(true)
                                 .decode();
    

    Don't forget to use builtin decoder if you want to scale down less than 50% and a HQ result.

提交回复
热议问题