Skip to content Skip to sidebar Skip to footer

Splitting And Rejoining A Bitmap

I am writing an Android app that processes large bitmaps, and need to split the bitmap into separate 'tiles' and process each tile individually before stiching them back together i

Solution 1:

You can use Canvas.drawBitmap to draw the processed tile back to the result bitmap. Use the function like this:

Canvascanvas=newCanvas(finalImg);
canvas.drawBitmap(tile,
                  null,
                  newRect(x, y,
                           x + tileDiameter, y + tileDiameter),
                  null);

Also notice that you probably need to get a mutable copy of tile since the one you get from Bitmap.createBitmap is immutable.

Post a Comment for "Splitting And Rejoining A Bitmap"