LucaMs Expert Licensed User Longtime User Jan 6, 2016 #1 ...and why should I pass MaxWidth and MaxHeight but it could return bigger dimensions? Thank you
Erel B4X founder Staff member Licensed User Longtime User Jan 6, 2016 #2 Exactly as described: The purpose of LoadBitmapSample is to reduce memory usage. It can be considered a bug to load an image with LoadBitmap instead of LoadBitmapSample (unless you know for sure that the image is not huge). The variables names are less important. Upvote 0
Exactly as described: The purpose of LoadBitmapSample is to reduce memory usage. It can be considered a bug to load an image with LoadBitmap instead of LoadBitmapSample (unless you know for sure that the image is not huge). The variables names are less important.
LucaMs Expert Licensed User Longtime User Feb 25, 2016 #3 "The decoder will subsample the bitmap if MaxWidth or MaxHeight are smaller that the bitmap dimensions." subsample... I suppose it should return a proportional sample, smaller or equal to MaxWidth and MaxHeight. Is this correct? In a project I get (w.h logs): original (file): 3543.2215 ImageView : 293.293 (MaxWidth and MaxHeight I passed to LoadBitmapSample) 'sampled' : 443.277 442 is bigger than 293 277 is smaller than 293 Upvote 0
"The decoder will subsample the bitmap if MaxWidth or MaxHeight are smaller that the bitmap dimensions." subsample... I suppose it should return a proportional sample, smaller or equal to MaxWidth and MaxHeight. Is this correct? In a project I get (w.h logs): original (file): 3543.2215 ImageView : 293.293 (MaxWidth and MaxHeight I passed to LoadBitmapSample) 'sampled' : 443.277 442 is bigger than 293 277 is smaller than 293
JordiCP Expert Licensed User Longtime User Feb 25, 2016 #4 I think that it searches for the "nearest" power-of-2 (1/2, 1/4th, 1/8th...) subsample of the original bitmap which "better fits" the given maxWidth and maxHeight. 3543/293 = 2215/277 = 8 aprox (this is the subsampling) Also, the scale factor of the subsampled bitmap remains (3543/2215 = 442/277 = 1.6 aprox ) As in your case you gave square dimensions for a non-square original bitmap, it made its best Upvote 0
I think that it searches for the "nearest" power-of-2 (1/2, 1/4th, 1/8th...) subsample of the original bitmap which "better fits" the given maxWidth and maxHeight. 3543/293 = 2215/277 = 8 aprox (this is the subsampling) Also, the scale factor of the subsampled bitmap remains (3543/2215 = 442/277 = 1.6 aprox ) As in your case you gave square dimensions for a non-square original bitmap, it made its best
LucaMs Expert Licensed User Longtime User Feb 25, 2016 #6 sorex said: the proportions are right. Click to expand... JordiCP said: which "better fits" the given maxWidth and maxHeight. Click to expand... LucaMs said: 442 is bigger than 293 Click to expand... then, it does not fits, it exceeds. Anyway, I have a small project that does not work as it should. I make a few more attempts then I'll publish it, hoping in your abilities Thank you Upvote 0
sorex said: the proportions are right. Click to expand... JordiCP said: which "better fits" the given maxWidth and maxHeight. Click to expand... LucaMs said: 442 is bigger than 293 Click to expand... then, it does not fits, it exceeds. Anyway, I have a small project that does not work as it should. I make a few more attempts then I'll publish it, hoping in your abilities Thank you
S sorex Expert Licensed User Longtime User Feb 25, 2016 #7 maybe you should show some code on how you use the routine. Upvote 0
LucaMs Expert Licensed User Longtime User Feb 25, 2016 #8 sorex said: maybe you should show some code on how you use the routine. Click to expand... I still wanted to look for the bug, but since you're so helpful... I am attaching the "project" . Attachments Choose image.zip Choose image.zip 13.3 KB · Views: 477 Upvote 0
sorex said: maybe you should show some code on how you use the routine. Click to expand... I still wanted to look for the bug, but since you're so helpful... I am attaching the "project" .
S sorex Expert Licensed User Longtime User Feb 25, 2016 #9 just had a quick look at it and the results are indeed strange. I don't know if it is an implementation of @Erel or calls to standard api's. Upvote 0
just had a quick look at it and the results are indeed strange. I don't know if it is an implementation of @Erel or calls to standard api's.
LucaMs Expert Licensed User Longtime User Feb 26, 2016 #10 sorex said: just had a quick look at it and the results are indeed strange. Click to expand... It seems to work well on an Android 4.4.2, not well on a 4.0.4. Last edited: Feb 26, 2016 Upvote 0
sorex said: just had a quick look at it and the results are indeed strange. Click to expand... It seems to work well on an Android 4.4.2, not well on a 4.0.4.
LucaMs Expert Licensed User Longtime User Feb 26, 2016 #11 I solved using the canvases. This problem remains, however. Thanks, especially to whom this is not interested Upvote 0
I solved using the canvases. This problem remains, however. Thanks, especially to whom this is not interested
victormedranop Well-Known Member Licensed User Longtime User Dec 13, 2016 #12 LucaMs, use canvases? how's that. thanks victor Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 13, 2016 #13 Which problem are you trying to solve? Upvote 0
LucaMs Expert Licensed User Longtime User Dec 13, 2016 #14 victormedranop said: LucaMs, use canvases? how's that. thanks victor Click to expand... https://www.b4x.com/android/forum/threads/imageview-bitmap-centered.43779/ Upvote 0
victormedranop said: LucaMs, use canvases? how's that. thanks victor Click to expand... https://www.b4x.com/android/forum/threads/imageview-bitmap-centered.43779/