How do i get a part of a bitmap
(which is in a imageview
) saved as shown in the picture. All i need to do is to crop a particular image
using (x,y)
coordinates. all that i have is x,y coordinates
and nothing else to select the cropped area
. Between, user doesnt select the crop area
. So its enough if its static
. yellow part is an imageview(not the whole activity)
Asked
Active
Viewed 4,684 times
0

Community
- 1
- 1

Seshu Vinay
- 13,560
- 9
- 60
- 109
1 Answers
7
just create a new Bitmap and use the original one as the source. Insert as x and y coordinates 0 and your custom width and hight. public static Bitmap createBitmap (Bitmap source, int x, int y, int width, int height) .
This post describes how to get a Bitmap from a view, in your case the imageview you want to crop. Converting a view to Bitmap without displaying it in Android?
-
1i tried this, its working. but my problem is i have adapted pinch zoom (multi touch) so i have to crop the zoomed image(only visible part of image) but its cropping the entire image... any idea? – Seshu Vinay Dec 20 '11 at 06:27
-
sorry i don´t have the time right now to write a snippet, but you have to enable the drawingcache for your imageview and extract the bitmap by Bitmap newBitmap = imageView.getDrawingCache(); i hope this will help you – andreasg Dec 20 '11 at 10:00
-
I have already tried that. its returning a part of the original image and not zoomed image – Seshu Vinay Dec 20 '11 at 10:03
-
how do you scale the content of the image view? – andreasg Dec 20 '11 at 10:08