I use this method to compress an image
if(bitmapObject.compress(Bitmap.CompressFormat.PNG, 100, fOut))
{
...
}
But the image I get is much smaller ( in the dimension ) that was before the compress action.
My application need to send the compressed image thru the network - so i want to send as less data as I can ... but I must to keep the original size of the image.
Is there some other way to keep the original bitmap dimension with some compress ?
i think you use this method to compress the bitmap
If you are using PNG format then it will not compress your image because PNG is a lossless format. use JPEG for compressing your image and use 0 instead of 100 in quality.
Quality Accepts 0 - 100
0 = MAX Compression (Least Quality which is suitable for Small images)
100 = Least Compression (MAX Quality which is suitable for Big images)
I have done this way:
Get Compressed Bitmap from Singleton class:
ImageUtils.java:
Dimensions are same after compressing Bitmap.
How did I checked ?
Output:
Hope this will help you.
Are you sure it is smaller?
Gives
Maybe you get your bitmap from a resource, in which case the bitmap dimension will depend on the phone screen density