Android Photo / Gallery Question.

Asked 2 years ago, Updated 2 years ago, 25 views

Currently, we have implemented the function of taking pictures and calling up gallery pictures in the Android app.

Currently, if you take a picture and press OK, it should come out as a vertical image.

The screen is rotated, so the horizontal size keeps coming out.

There is a resolution setting when taking pictures in the phone camera setting, but the image size is fixed to the resolution, so I want to know what to do to keep the ratio without rotating the picture. If you crop it, it comes out well, but if you don't crop it, it comes out like this <

android

2022-09-22 12:42

2 Answers

When taking pictures on some devices, there are cases where the image is stored rotated. If this is the case, you should implement it by taking rotation information from the Exif data in the image file and rotating the bitmap again when loading the image. Please refer to the link below for detailed implementation instructions.

Additionally, if you use the Picasso library, you do not need to perform rotation processing directly because rotation-related processing is implemented internally. If you have a library of image loaders, search to see if these features are available. If you look at the 162 line in the code below, you can see how Picasso handles rotation.


2022-09-22 12:42

By the way, it takes a lot of air-conditioning to implement the gallery and camera functions. In that case, using Intent is also a good idea.

This article is related to the image library. It's been three years, but it's still useful, so I've seen it more than five times. http://d2.naver.com/helloworld/429368


2022-09-22 12:42

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.