Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading only part of a bitmap file in Android

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 custom loading routines to handle the raw data?

Thanks, Sandor

like image 562
Schermvlieger Avatar asked Mar 30 '10 14:03

Schermvlieger


1 Answers

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

like image 188
Steve Haley Avatar answered Oct 16 '22 06:10

Steve Haley