Loading only part of a bitmap file in Android

后端 未结 5 803
醉话见心
醉话见心 2020-12-14 19:14

I would like to load a cropped version of a bitmap image into a Bitmap object, without loading the original bitmap as well.

Is this at all possible without writing c

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 20:14

    It's actually very straightforward to do. Use

    Bitmap yourBitmap = Bitmap.createBitmap(sourceBitmap, x to start from, y to start from, width, height)

    Update: use BitmapRegionDecoder

提交回复
热议问题