if image.width>480 or image.height>480 then 'only resize if bigger than screen size
r=image.width/image.height
if image.width<image.height then
w=480 'portrait
h=w*r
else
h=480 'landscape
w=h*r
end if
end if
you have the calculations I gave you. you just need to adopt it a bit like
B4X:if image.width>480 or image.height>480 then 'only resize if bigger than screen size r=image.width/image.height if image.width>image.height then w=480 h=w*r else h=480 w=h*r end if end if
probably not 100% right but you get the idea.
I want to avoit to load enormous images in memory:
Private bmp AsBitmap = LoadBitmap(Dir, FileName) does this action load them in memory on only after imv.invalidate is fired?
Dim IM As AS_ImageUtils
im.GetImageDimensions
And I suggest strongly to use LoadScaledBitmap from this lib instead of LoadBitmapSample because LoadBitmapSample just resamples the image, so the final size of the image is not exactly the size you defined. LoadScaledBitmap will really resize it (and moreover the density won't be changed, so no surprise with ImageViews). With big images, the difference between these functions is far from being neglectable.B4X:Dim IM As AS_ImageUtils im.GetImageDimensions
*The image is not loaded into memory, from @Informatix accellerated surface lib
Solved, thanks
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?