in my application I want to have a frame (with a hole in the middle) and an image under it. I want to be able to drag and zoom the image to fit (the face in the picture) it in the frame. Then Crop the image (could I find the pixel x,y that are in the border of the screen?) and then save the zoomed image so that I can put the frame over it then.
Any suggestions? If possible please tell me the classes I will have to use.
Thanks!!
It is possible to do all the functionalities (What you have discussed above) using Android View class with onDraw method and canvas Object.
Refer the link:
http://developer.android.com/reference/android/graphics/Canvas.html
Related
I have back side TouchImageview, which having zoom in/out functionality, I am setting up bitmap on ImageView, the size of Bitmap is w-h (2100 x 2900), I have particular X-Y co-ordinate, now I want to add Overlay view at same co-ordinate as per imageview's X-Y co-ordinate, the background imageview should be touchable.
Can you please let me know solution for the same.
Thank you.
I'm an iOS developer, but can be answer to your question, as I'm sure that these things are also possible in Android ! ;)
You can follow these steps:
Don’t make any change in your current flow.
Add overlay view the way you want.
Take screenshot of the back image view which are showing location, may be of particular size (or the exact size of circle on overlay).
Show that captured screenshot (image) at circle view position (you can have an another image view for that).
Zoom that image view (From Step.4)
You are done!
Goodluck.
I'm developing an android app in which I want to integrate a feature using which user can take screenshot, doodle something on it and then send it via mail.
How to implement this? I just need a pen for doodling and an eraser to erase last doodle.
Take a look at this library :
ActiveDoodle
You can display two ImageViews on top of each other: the bottom one containing the photo, the top one containing an initially transparent Bitmap. In the top ImageView's onTouchEvent() method you can transform touch events into strokes of pen applied to the bitmap using a Canvas. You might want to read up on MotionEvents and Canvases.
After the user is done with doodling, you can load the screenshot to a Bitmap, rescale the doodle bitmap to match the screenshot's size, and draw in on top, again using a Canvas. Reading about Porter/Duff algebra will probably prove useful with applying an XferMode to a Paint.
is there any way to blur only part of an image in android?
searched a lot but dint find any help.
most of the examples use gaussian blur which blurs full imageview.
i want to allow user to dynamically draw rectangle on imageview & on action up
area within rectangle should be blured.
any help will be really appreciated.
Bluring images on the fly is not an easy task, ask Roman Nurik (The one behind Muzei app)
He gave useful tips on this Google+ post but it's for animated images, from focus to blur.
In your case, I would say that you need to (roughly):
Get the bounds of the drawn rectangle
Get the image part that corresponds to the previous bounds
Blur on the fly the previous image part
Draw, into the same canvas, the blurred image part on top of the original image
Set up a onDrag Listener to move the drawn rectangle and do again step 1
EDIT: After re-thinking about it, computing and draw a blurred area each time the drawn rectangle move it too heavy, it won't work. The solution is probably this:
Blur the entire image and keep it into memory
Get the bounds of the drawn rectangle
Get the part of the blurred image that corresponds to the previous bounds
Draw, into the same canvas, the blurred image part on top of the original image
Set up a onDrag Listener to move the drawn rectangle to do again step 2-3-4
put the image view in a relative layout.
you detect the touch events of the user.
for each rectangle that he is drawing, you add an image view of it is size superposed to the initial one (I mean in the same relative layout) and of course with your blur effect.
you will see your image view blured part by part ...
put another layout on the half part of the image and set a translucent type background to the layout.
Once you have drawn your rectangle set alpha = 0.5 or as per your need so that your dynamic view that you have drawn will look blurred.
This is code for blur:
http://shaikhhamadali.blogspot.in/2013/07/gaussian-blur-imagebitmap-in-imageview.html
In this code computeConvolution3x3 method is used for computing the blur.For computing blur it convert the bitmap in to pixel array then it apply on those pixel. So you have to just do is get pixels array of that part of the image that you want blur.
I want to create a resize feature of my application but I cannot find a sample implementation of it. Many tutorials offers pinch to zoom.
My problem now is how to implement draggable edges to resize the image just like in ordinary image editor. Do you have any idea how to do this? Just like putting circles/points on the 4 corners of the ImageView like the sample image below.
Is it possible to use the crop library of android to have draggable image?
You can draw the control point, and handle all festure in this point
last month i develop a Android handwritting note app. In this app, i inherit View, and control View.onDraw directly. I draw the image and all control indicator in onDraw, and handle screen touch within the scope of the screen.
This app isn't accomplished, it become a opensource project, you can see the source at https://bitbucket.org/gd920129/white-board/
I need some activity with image cropping, but without getting crop image, just need coordinates angles of rectangle area on image which i can move and resize. How i can make this or where i can find such library with this functional? Sorry for my bad English.
For your purpose you better to use Android Canvas. When you touch a particular point you can get details of that point using 'OnTouch'(http://developer.android.com/reference/android/view/View.OnTouchListener.html) method in android.