B4J Question Very slow CROP function on large image

wimpie3

Well-Known Member
Licensed User
Longtime User
I want to copy very small parts (32x32 pixels) from one relatively big (5600x1848) B4XBitmap to another B4XBitmap.

The problem is that this is very slow in B4J. The DrawBitmap command to draw my newly generated 32x32 pixel images is super fast, but the bigBitmap.Crop(0,0,32,32) function to generate a small image, is super slow.

I could split the huge image file in parts, but I'm not sure if that will have an influence on the performance.

Who knows how to make this faster? I absolutely want to use XUI.
 
Last edited:

Lucas Siqueira

Active Member
Licensed User
Longtime User
His idea was the same one used on worldvision (Netflix: Billionaire Battle: The Google Earth Case), Google Earth, taking a giant image (map of the world), cutting it into smaller parts and rendering on the screen only a few smaller pieces depending on the zoom that have...

I believe the way you are doing it is the best way to render large images.

Make sure you are reusing the bitmap already loaded into the computer's memory when cutting it...

example: create a bitmap in globals that will load the larger image...

and reuse it to cut as many times as necessary
 
Upvote 0

Lucas Siqueira

Active Member
Licensed User
Longtime User
 
Upvote 0

wimpie3

Well-Known Member
Licensed User
Longtime User
HugeImageView is used to show a large image. I don't want that. I just need small parts of a big image. And yes, that big image is only loaded once of course.
 
Upvote 0

wimpie3

Well-Known Member
Licensed User
Longtime User
When I use the native B4J canvas and copy the small images using Canvas1.DrawImage2, things are super fluent... so I guess the crop function isn't as fast as it could be.
 
Upvote 0
Top