Reputation: 1235
Is it possible to reduce the image resolution while maintaining the original width and height?
I have tried several options using BitmapFactoryOptions:
Both ways reduce the image width and height. But what I want is to just reducing the image resolution without affecting the image width and height.
Upvotes: 1
Views: 3904
Reputation: 1006564
The definition of "resolution" is "width and height". Hence, you cannot change the resolution without changing the width and height.
The image is captured from android device camera. I use the BitmapFactory to resize the image upon onActivityResult.
Whether or not you can do anything to reduce the file size further depends a lot on what the camera application does, and there are hundreds, perhaps thousands, of camera applications.
You are welcome to experiment with:
Saving the JPEG at lower quality when you write it out, using compress()
Reducing the bit depth when you read it in, using inPreferredConfig
and RGB_565
Finding other JPEG optimization algorithms and trying to get them working on Android, possibly involving the NDK
Upvotes: 1
Reputation: 2150
I guess you are unclear with the very definition of resolution.
perhaps you want to reduce the resolution of the image (width and height) and then show it in an ImageView of greater size .
For that you should simply set the reduced resolution image as the source of any greater size ImageView with Scaling (ScaleType) set to Stretch
Upvotes: 0