How to get ROI of an image in Android
I have an image file (.jpg) which contains image like Face. From my application i want to capture that particular Face part and copy that part into a new bitmap file. I have a rectangular co-ordinates of that开发者_运维问答 Face part, so how do i capture only Face part from the image file and copy that into a bitmap file??
Could any body help me to get rid of this problem....
Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height) will do the creation. For save, read this: Save bitmap to location
You could use
bitmap1.getPixel(x,y)
on the source image and using
bitmap2.setPixel(x,y,color)
on the destination image.
There is also a respective
bitmap1.getPixels( pixelArray, offset, stride, x, y, width, height)
which is undoubtedly faster.
精彩评论