Loading images

Blitz3D Forums/Blitz3D Programming/Loading images

ervin(Posted 2008) [#1]
Hi all.

Does anyone know how to go about loading a portion of a very large image?

For example, I have an image of 100,000 by 100,000 pixels, and of course this just won't load into B3D.
What I'd like to do is load a section of it (for example 1000 by 1000 pixels, starting at (90,000 , 90,000).


bytecode77(Posted 2008) [#2]
this is not possible, unless you write yourself a library, which can load a BMP file manually. if you can do that, you just have to read the correct pixels.
btw: what's the usage of such a large image?


TomToad(Posted 2008) [#3]
If you're using it for 2D and the large image can be divided into smaller same sized images, then you can use LoadAnimImage(filename,width,height,first,count)
For example, suppose your 100,000 x 100,000 image is divided into a grid of 1,000x1000 squares.
that would make your grid 100 tiles across and 100 tiles down.
Pixel 90000,90000 would be located at tile 90,90
So the first parameter would be 90*100+90, or 9090
The Count parameter would be 1 to load in only one image.
The entire command would be
Image = LoadAnimImage("Image.bmp",1000,1000,9090,1)

To be honest, I don't have any 100,000x100,000 images lying around to test this on, but it has worked on smaller sized images in the same way.


Ross C(Posted 2008) [#4]
If i think it's what you need, then look into tilemaps :o)

I get a 16 bit .bmp file to be around 1,100 GB at that size.


ervin(Posted 2008) [#5]
Thanks for your help everyone.
I'll give your suggestions a go.
I'm very interested to see if the LoadAnimImage idea will work.

Devils Child - I'm trying to write a program which will let me view any part of any image, no matter what size the image.