Skip to content

Well, Not Really a Mystery

April 6, 2015

15-04-06 mysterysolved

Yesterday I could not figure out why the last line of my dynamically generated image was overwriting the first line. I put different patterns in the first and last lines and a diagnostic print in the code. It turns out that there was nothing wrong at all, bitmaps are addressed from 0,0 at the bottom left corner so the first line goes at the bottom and the last line at the top. Because I had copied that data from an existing .bmp it was already laid out that way.

I also noticed that the .bmp file format has fields for setting the colors. Here I’m displaying the image in gold on blue. Pretty, huh. There are also fields for setting vertical and horizontal resolution but i think those are being ignored.

I had been wondering also, why bitmaps were displaying at a reasonable size on my retina macbook. It turns out that, by default, the macbook scales things so the 2560X1600 display looks like 1280X800.

Here’s a reference for the .bmp file format This chart was pretty handy too although i wish it had the offsets explicitly printed.

Advertisements

From → web server

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: