General information
Title:
Retriving and displaying in image from BLOB
Hi,
I have the following specification for an image stored in SQL BLOB field. I thought the image would be stored in a format such as tiff or jpg but it seems to have its own format as shown below. I have never done anything like this and was hoping someone would have a few pointers. The end result is to display it in a browser which I can do easily enough once i get the image into another format.
Thanks
Database Image Export Format
Image is stored in BLOB (Binary Long Object) format (a raw sequence of bytes).
First 20 bytes is an image header, following the raw image data as shown in the table below.
Offset Length Field Description
0 4 width Image width in pixels
4 4 height Image height in pixels
8 4 linesize Scanline (row) width in bytes
12 4 xres X-resolution in DPI (dots per inch)
16 4 yres Y-resolution in DPI
20 linesize*height data Raw uncompressed pixel data
Pixel data have the following format:
Each scanline (row) is aligned to 4-byte boundary.
Each pixel is encoded in 1 bit (monochrome image)
Leftmost pixel is bit 0 (rightmost) of the corresponding byte.
Black is 1, white is 0.
Example
This scanline:
byte 0 byte 1 byte linesize-1
| | ... |
10010111 00010011
corresponds to the following sequence of pixels:
XXX.X..X XX..X...
where X represents black pixel, . represents white (background) pixel.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only