Image scaling problem

agraham

Expert
Licensed User
Longtime User
There seems to be a problem with Bitmap>InitializeSample. The resulting bitmaps are larger than expected the sizes appear to follow some sort of binary progression instead oscaling properly.

Given dimensions of below 64 the bitmap sizes are a few pixels too big. For dimensions above 64 it goes really wrong.

Given dimensions of 64 it scales to 79
...after this the size is always 79
Given dimensions of 107 it scales to 159
...after this the size is always 159
Given dimensions of 160 scales to 319
...after this the size is always 319
Given dimensions of 319 it scales to 638
...after this the size is always 638
Given dimensions of 638 it scales to 1275
...after this the size is always 1275

Erel! :confused:

EDIT:- I think I understand. InitialiseSample doesn't do what you think it does. I assumed that it did what my B4A Jpeg library did and properly scaled a Bitmap to match provided dimensions. However it looks as though it can only produce approximations to the requested dimensions and can do so only for binary fractions of the original size 1/2, 1/4, 1/8 etc. so it's not as useful as I hoped.
 
Last edited:
Top