View Single Post
Old 12-15-2016, 11:41 PM   #2
kitomer
Member
kitomer began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Dec 2010
Device: Kindle 3 Wi-Fi
In case it is of interest to someone here, I will tell you about mit findings regarding the bitmap format when used in combination with the tool "eips" on the kindle 3 keyboard:

The bitmap format usually (simplified) contains a 14 byte header that includes a number that is the offset in bytes from the file start to the start of the pixel data. This header is followed by a 40 byte long information header followed by a color table and an optional gap finally followed by the pixel data bytes.

Since the kindle 3 keyboard has a display capable of displaying 16 distinct gray tones the needed bits per pixel is 4. But when I tried to create a bitmap using ImageMagick (convert bla.jpg -colors 16 output.bmp) it did work _almost_. The resulting image (displayed using eips: eips -b output.bmp) is shown not correctly with the following visual glitches:

- The image is shown upside down

- The colors are weird (the image is recognizable but seems too bright)

- The image is split in vertically in approx. 1/3 and 2/3 halfs which are displayed in the wrong order. This led to the fix I found.

I inspected the bmp from ImageMagick (after a short detour using a buggy version of itself with even more glitches...) and found that the bmp is displayed ONLY if the pixel data bytes start at precisely 312 bytes (for a 4 bits per pixel bitmap with a 16 colors colortable).

Long story short: I did not find a program that would create a bmp which was displayed correctly on the kindele 3 keyboard. I had to create my own program which finally generated the attached file. Feel free to inspect it. If someone is interested in the program that generated this, please ask here, as I have to clean up the code a bit before publishing.

The reason I write this is to share the knowledge but also to ask: WHY is it that "eips" handles the bitmap format in such a broken way? Maybe I missed something.

Also: Anyone with a little time on their hands, maybe they could test the attached bmp on their devices and see how eips displays them? That would be very helpful in order to create more cross platform bmps. IMPORTANT: if you view the attached bmp using some image editor and such, the image is shown upside down (the bmp is interpreted correctly! only the kindle 3 keyboard will display it wrong, which is why the bmp is generated "wrong" in the sense of the bitmap format spec)
Attached Images
File Type: bmp final.bmp (234.7 KB, 206 views)

Last edited by kitomer; 12-15-2016 at 11:43 PM.
kitomer is offline   Reply With Quote