How much memory does an image take up?

Blitz3D Forums/Blitz3D Beginners Area/How much memory does an image take up?

BlackD(Posted 2004) [#1]
Trying to figure out how to calculate how much memory an image will take.. can someone just confirm if my working is correct?

(note, this isn't B3D code, just some mathematical working :))

XWidth*YWidth*ColorDepth = BitsPerImage
BitsPerImage/8=BytesPerImage
BytesPerImage/1024/1024=MegabytesPerImage

Thus, a 200x280x32 image for example, equals:
(in process from left to right, not a single equation)
200x280x32/8/1024/1024=0.213 or 213kb for the image.

Is this correct?

+BlackD


Ross C(Posted 2004) [#2]
0.213 MB = 218.1 ish KB :P

But yeah, thats correct :) I believe if you load 16 bit images into blitz using a 32 bit graphics command, they get converted to either 24bit or 32 bit anyway. Someone confirm that?


JBR(Posted 2004) [#3]
Graphics x,y, 16 uses 2 bytes per pixel
Graphics x,y, 32 uses 4 bytes per pixel

When an image is loaded it is converted to whatever the graphics command is set to.

Marg


Mustang(Posted 2004) [#4]
Check my my post in the end of this thread if you want 3D memory usage:

http://www.blitzbasic.co.nz/Community/posts.php?topic=24157


BlackD(Posted 2004) [#5]
Thanks :)