I tested the demo program with a picture with 6000 / 4000 pixels on my Samsung Galaxy S10, Android 11
And it works as expected.
Then I tested it on my Samsung Tablet S2, Android 7
And I get an Out of memory error message.
Then I tested it, after adding the line below to the Manifest Editor:
SetApplicationAttribute(android:largeHeap,"true")
It does not throw an error but the screen is flickering, even in Release mode, but it works.
The problem is that the entire bitmap is loaded which gives a memory request of width * height * 4 bytes.
Try to add the line above in the Manifest Editor.
Or, in the xResizeAndCrop module in the LoadImage routine, you could replace this line
xbmpImage = xui.LoadBitmap(Dir, FileName)
by this one.
xbmpImage = xui.LoadBitmapResize(Dir, FileName, 3000, 2000, True)
You might adapt the width and height values to your needs.
Of course, this will reduce the quality of the image, because it is downsized.
EDIT:
Do not use the modification above but use the solution in post #4.