Reputation: 11
When I tried to compress the size(width & height) of the picture, I have a question about the inSampleSize
property of BitmapFactory.Options()
. when inSampleSize
value is 1, the result is not compressed, when inSampleSize
value of 2, image compression half, when inSampleSize
value of 3, image compression half also, when inSampleSize
value of 4 image compression of 1/4, when inSampleSize
value of 6, the compression effect is equivalent to inSampleSize = 4
, when inSampleSize
is 8, image compression 1/8. so, I come to the preliminary conclusion : does the comopression only take effect when inSampleSize
value must be 2^n?
Upvotes: 1
Views: 484
Reputation: 329
Yes, from Javadocs in Android source code
Note: the decoder uses a final value based on powers of 2, any other value will be rounded down to the nearest power of 2.
Upvotes: 1