I have a surface view, 3 buttons one each for capture, use(invisible) and retake(invisible). I am using the Camera to take a picture. On image capture, use and retake buttons become visible and capture goes invisible. How to save the image in SD card on clicking the use button. Can anyone help with any example code. ??
Inshort I dont want to skip retake and skip option after capturing a pic in android !!! No use of intents !! only using android camera
How to skip 'retake and use' option after captureing photo from camera
Here is a nice tutorial on taking picture in Android: http://www.vogella.com/tutorials/AndroidCamera/article.html
In the nutshell, after you call Camera.takePicture(), a onPictureTaken() callback is called with jpeg image in byte[]. You convert this image to bitmap (preferably scaled down) for display, and you can write this byte[] as is to a .jpg file if the user likes it.
Related
I succesfully made this simple app of where you can either choose and image from gallery or take a picture: Pick Image From Gallery Or Camera In Android Studio Programmatically. But for my purpose, where the selected image needs to serve as a profile image, I want the image to be square.
Also, some photos that are selected from gallery are rotated (Not to mention they are rectangled)
Where do I go from here in order to make user crop and rotate the image before uploading it? I want the final result to be a square image with the correct rotation.
In terms of cropping the image, there are many image cropping libraries for Android for you to choose from.
It is possible that one of those will also allow the user to rotate the image. If not, you will need to handle that yourself.
If you only need to allow the user to rotate the image a few ways (e.g., portrait and landscape), you could use a Switch or Spinner to allow the user to choose a rotation, then rotate the ImageView to show them what it looks like. Once they choose a rotation to use, you can use a Matrix to rotate the Bitmap. Ideally, you would rotate the image after cropping, as photos are large and you may run out of memory trying to rotate a photo.
I am using the CWAC camera library in my application. I tried this and this is working fine showing the camera preview in the relevent Fregment.
Now all I want to past a picture on that camera preview and whenever I click button to take picture it should take picture with that image. I want image in forground and the camera preview in background of it . So is there any way to do that . Here is the sample code that I am using to take picture
This has nothing to do with the CWAC-Camera library. If you want to merge multiple image files together, you are welcome to do so, but you would do that after taking the picture.
I am developing an app which uses surface.callback to initialize the front camera when the app is started. I have done overlayering on the camera and added some buttons along with some funny images.
Now there are three ways to do this as far as my knowledge goes (and I am a newbie so if there's another method that would also be appreciable.)
Capture image: The problem is that if I capture the image from
camera, I won't get the funny images which are added on the top of
the camera preview.
Screenshot: As I have done this through overlayering, hence taking a
screenshot through code of a selected portion isn't yielding any
result also. Because it only takes the screenshot of the layer with
buttons and funny image but not the screenshot of the camera preview
as it is behind the layout containing above mentioned items.
Now the only resort is that I merge two images. One from my drawables
folder (funny images) and second obtained at runtime from front
camera.
Anyone who can kindly help me merge two images. I have seen some tutorials/codes but they take both images from drawables folder while my second image is obtained at runtime through camera.
You can capture the camera image and edit it (overlay with funny images) before writing it to file.
i want to crop a image during capture not after capture.
like this image.
just replace save button with capture.
the rectangle should be realizable.just like the crop activity.
the thing i was doing was.
1st=capture image.
2nd=crop.
now i want to crop image during capture.
any help???
This is possible, Just think a different approach. Make a trick with camera preview. Taking a picture usually requires that your users see a preview of their subject before clicking the shutter. To do so, you can use a SurfaceView to draw previews of what the camera sensor is picking up. Now create a viewFinder for your camera capture activity. Now your make the compatible code to change the viewFinder size dynamically, which allow you to select the region. And finally save the Image from bitmap view inside ViewFinder. This is exactly what you want.
Please ask if you have not got my point. Best of luck.
I want to take an particular part of an image from the image preview. Is it possible, if so how to do that?
for ex,
I just want to show some limit to the user, so they can take partial part of an image. How to show my surface view like the given above picture and how to take particular part of an image??
Thanks is in advance.
I don't know of any way to capture less than the full preview. You could display the crop marks as an overlay, and retrieve that portion of the bitmap in post-processing after you capture the image.