user1202434 user1202434 - 24 days ago 6
C# Question

Image size in MB from pixel height and pizel width

maybe a stupid question, but:
how do you calculate the size of an image in mega bytes when you know the images
pixel height and pixel width?
Thanks

Answer

Depends on color depth. If you were using 8-bit pixels, it would be:

height * width / 1048576

If you were using 32-bit pixels, it would be:

4*height*width/1048576 which is height*width/262144