Note that there are some explanatory texts on larger screens.

plurals
  1. POBMP file format not read properly?
    primarykey
    data
    text
    <p><strong>Hey folks!</strong></p> <p>I got this <a href="http://dl.dropbox.com/u/39438681/Bilder/StackOverflow/test6.bmp" rel="nofollow" title="The image">image.bmp</a>. When i read it with all padding included and such i get <a href="http://dl.dropbox.com/u/39438681/Bilder/StackOverflow/scrndmp.PNG" rel="nofollow" title="The result">this</a> result.</p> <p>What am i doing wrong here besides reading the image upside down? I don't find anything relative on Wikipedia or by googling. It seems that after 24 pixels width the image is mirrored 8 pixels. Why!? I don't get it!? How can i fix this!?</p> <p>I'm reading the file with some C++ code on Windows reading the BMP file raw. The image file is monochrome. 1 bit per pixel.</p> <p>Code for showing bitmap data:</p> <pre><code>unsigned int count = 0; // Bit counting variable unsigned char *bitmap_data = new char[size]; // Array containing the raw data of the image for(unsigned int i=0; i&lt;size; i++){ // This for-loop goes through every byte of the bitmap_data for(int j=1; j&lt;256; j*=2){ // This gives j 1, 2, 4, 8, 16, 32, 64 and 128. Used to go through every bit in the bitmap_data byte if(count &gt;= width){ // Checking if the row is ended cout &lt;&lt; "\n"; // Line feed while(count &gt; 32) count -=32; // For padding. if(count &lt; 24) i++; if(count &lt; 16) i++; if(count &lt; 8) i++; count = 0; // resetting bit count and break out to next row break; } if(i&gt;=size) break; // Just in case count++; // Increment the bitcounter. Need to be after end of row check if(bitmap_data[i] &amp; j){ // Compare bits cout &lt;&lt; (char)0xDB; // Block }else{ cout &lt;&lt; (char)' '; // Space } } } </code></pre> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload