I would usually do this by making the ImageView larger than the screen in one direction (and the same size as the screen in the other direction).
For your example in post #6, which is too short for the screen, I would scale the image up until it was the same height as the screen, which will also make the image wider than the screen, and then center it horizontally with something like:
B4X:
ImageView.Left = -(excess_horizontal_size / 2)
Similar procedure if the image is too narrow for the screen: scale it to be same width as screen, image will then be taller than the screen, center it vertically with eg: ImageView.Top = -(ScreenHeight - ImageHeight) / 2
edit: probably no need to center it - I just did it out of habit
I used this solution and it works ok. Thank you for all the answers.
B4X:
Image1.Initialize("Image1")
Image1.Visible=True
Dim Image_x As Int=100%x
Dim Image_y As Int=100%y/5
Dim Bitmap_x As Int
Dim Bitmap_y As Int
Dim Bitmap1 As Bitmap
Bitmap1.Initialize(File.DirAssets,"apple.png")
Bitmap_x=(Bitmap1.Width*Image_y)/Bitmap1.Height
Bitmap_y=Image_y
Page1.RootPanel.AddView(Image1,-(Bitmap_x-Image_x)/2,0,Bitmap_x,Bitmap_y)
Image1.Bitmap = LoadBitmap (File.DirAssets,"apple.png")