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.
Related
Well i have build an app using flutter that fetch images from unsplash api and set them as wallpaper using flutter_wallpaper_manager package. Its successfully does that part, but the problem is the final result in homescreen wallpaper looks left aligned. It save the left portion of the image as wallpaper.
Now i wants to know is there any way that i can save the middle part of the image as wallpaper? if there, then how?
Example:
Preview before setting-
Result after setting as wallpaper-
So as shown above, how to solve this problem and save the image as wallpaper as shown as wallpaper.
Hey there I am developing an android app to add filters i am first getting the images from gallery and camera the i am overlaying another image in same image view but the problem is this that the image i overlayed is of fixed size. I want to resize and reposition it during run time. Watch this video for reference
https://youtu.be/kGbvO--RDwU
I just need your suggestions. I have overlayed the image perfectly. Now i just need to resize, repostion or rotate that image on run time
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.
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 do have some images (example) which will be displayed differently depending on the software I am using.
When I open the image in my browser, the picture loads from the right side to the left (in contrast to other images which are loading from top to bottom).
Browser:
When I display the same image in an Android Application (via UrlImageViewHelper) the image will be displayed with an rotation of 90°.
Android:
'Normal' Images (that are loading from the top downwards) are being displayed correctly in my application.
Questions
Where does the browser get the information about the orientation of the image?
How could I implement an Android ImageView that is aware of the original orientation of the image?
Try this:
Put the rotated jpeg in your res/drawable. Set an ImageView to use that. See what happens.
UrlImageViewHelper doesn't actually do special image loading. It just uses the BitmapFactory like it should.
This is very likely to be an Android framework/libjpeg bug where jpeg rotation EXIF tag is not being honored.