A simple example:
BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inSampleSize = scale; Bitmap bmp = BitmapFactory.decodeStream(is, null, opts);
When I pass a scale value not equal to the power of two, the bitmap still scales to the nearest power of 2 values. For example, if scale = 3 , then for some reason the actual scale becomes 2 . Maybe because I use hardware acceleration?
Anyway, how can I scale a bitmap to a value other than level 2 without memory allocation for a full bitmap?
PS I know that using the power of the two is much faster, but in my case the time is not so critical, and I need to scale the image exactly to the scale provided (otherwise it will become too large or too small) - I'm "woking with image processing, so big the image is not such a problem ( ImageView scales it to the required size), but to apply some filter, for example, additional time is required.
source share