I have images stored into sd card. I want to divide the image into sixteen equal parts. How to do it using bitmap?
Give it a try to somthing like this:
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
final int width = dm.widthPixels;
final int height = dm.heightPixels;
final int pixelByCol = width / 4;
final int pixelByRow = height / 4;
List bs = new ArrayList();
Bitmap image =
for (int i = 0; i < 4) {
for (int j = 0; j < 4) {
int startX = pixelByCol * i;
int startY = pixelByRow * j;
Bitmap b = Bitmap.createBitmap(image, startX, startY, pixelByCol, pixelByRow);
bs.add(b);
}
}
bs <- your bitmaps