Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do BITMAPS load "upwards"?

If you have a really really large JPG and a BMP embedded on HTML and you load it into Firefox, you will notice that the JPG will load "downwards" (paint from left to right, then down) and the BMP will load "upwards" (paint from right to left, then up).

Just curious. :)

like image 556
Ian Avatar asked Aug 30 '10 15:08

Ian


People also ask

Why are Windows device-independent bitmaps upside down?

Something that catches out everybody the first time they encounter it is that Windows device-independent bitmaps are upside down, in the sense that the first row of pixels corresponds to the bottom scan line of the image, and subsequent rows of pixels continue upward, with the final row of pixels corresponding to the topmost scan line.

What is the use of bit map?

The picture can be manipulated, that is can be written to, changed or even copied. Bit maps can usually be used to display pictures on word processors, audience presentations or even database files. You can create a bitmap to do several functions like display it on a window or paint a geometric area where you would be using the bitmap for a brush.

What is a bitmap in memory?

It is also known as bitmap index or a bit array. The memory is divided into units for bitmap. These units may range from a few bytes to several kilobytes. Each memory unit is associated with a bit in the bitmap. If the unit is occupied, the bit is 1 and if it is empty, the bit is zero.

Why is the unit size in bitmaps so important?

The unit size in bitmaps is very important and should be chosen with care. If the unit size is smaller, the bitmap will be larger as it will hold the value 0 or 1 for each of the units. Similarly, if the unit size is larger, bitmap will be smaller.


2 Answers

I wrote a bitmap parser a while back, and if I remember correctly, bitmaps store the image backwards. That is, it stores the lower rows first and the higher rows last. The data arrives to your browser in-order, so that's why you can watch it load from the bottom up.

EDIT: Here's a better link that pretty much tells you everything you would ever want to know about a bitmap file: http://en.wikipedia.org/wiki/BMP_file_format

like image 119
MGSoto Avatar answered Nov 15 '22 12:11

MGSoto


Bitmap coordinates start at the bottom left of the screen - this makes perfect sense if you think of a graph, you start the origin at the lower left.

Most graphics devices start at the top left - because raster scanning displays like CRTs started the scan at the top (why?) and LCDs continued the standard

like image 31
Martin Beckett Avatar answered Nov 15 '22 12:11

Martin Beckett