<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[24-bit bitmap erstellen]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>nachfolgender Code erzeugt ein einfaches 24-Bit bmp-File. Wenn ich jedoch von dem erzeugten Bild die Endung in .txt umwandle, steht in der Textfile neben den Bilddaten auch Header + Padding-Bits. Bei Bildern die in Paint o.a. erstellt werden passiert das nicht. Wo liegt der Unterschied, mein Fehler?</p>
<pre><code>// /.../
ifstream filein(input.c_str(), ios::in|ios::binary);
ofstream fileout(output.c_str(), ios::out|ios::binary);
// /.../
fileout.write(memblock_header, (sizeof(header)));
filein.read(memblock_file, (sizeof(file)));
// /.../
fileout.write(memblock_file, (sizeof(file)));
// /.../
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/323874/24-bit-bitmap-erstellen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Jul 2026 10:52:17 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/323874.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 20 Feb 2014 23:56:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 24-bit bitmap erstellen on Thu, 20 Feb 2014 23:56:30 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>nachfolgender Code erzeugt ein einfaches 24-Bit bmp-File. Wenn ich jedoch von dem erzeugten Bild die Endung in .txt umwandle, steht in der Textfile neben den Bilddaten auch Header + Padding-Bits. Bei Bildern die in Paint o.a. erstellt werden passiert das nicht. Wo liegt der Unterschied, mein Fehler?</p>
<pre><code>// /.../
ifstream filein(input.c_str(), ios::in|ios::binary);
ofstream fileout(output.c_str(), ios::out|ios::binary);
// /.../
fileout.write(memblock_header, (sizeof(header)));
filein.read(memblock_file, (sizeof(file)));
// /.../
fileout.write(memblock_file, (sizeof(file)));
// /.../
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2384311</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2384311</guid><dc:creator><![CDATA[Peter43]]></dc:creator><pubDate>Thu, 20 Feb 2014 23:56:30 GMT</pubDate></item><item><title><![CDATA[Reply to 24-bit bitmap erstellen on Thu, 20 Feb 2014 23:58:48 GMT]]></title><description><![CDATA[<p>Den Header haste doch selber in Zeile 5 rausgeschrieben.</p>
<p>Das Padding musst Du ausmachen, wenn Du so rausschreuben willst,<br />
#pragma pack<br />
oder so, je nach compiler.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2384312</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2384312</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Thu, 20 Feb 2014 23:58:48 GMT</pubDate></item><item><title><![CDATA[Reply to 24-bit bitmap erstellen on Fri, 21 Feb 2014 00:12:21 GMT]]></title><description><![CDATA[<p>Hm, ich bin etwas verwirrt, aber danke schonmal.</p>
<p>Meinst du sowas?</p>
<pre><code>#pragma pack(2)
</code></pre>
<p>falls ja, ist vorhanden.</p>
<p>Mir es geht hier um die Padding-Bits am Ende jeder Zeile des Bildes.<br />
$ = Padding-Bits<br />
So sieht es aus:<br />
&quot;BM&gt; 6 (      Ä Ä TSET $$&quot;</p>
<p>So sollte es aussehen:<br />
&quot;TSET &quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2384313</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2384313</guid><dc:creator><![CDATA[Peter43]]></dc:creator><pubDate>Fri, 21 Feb 2014 00:12:21 GMT</pubDate></item><item><title><![CDATA[Reply to 24-bit bitmap erstellen on Fri, 21 Feb 2014 00:18:31 GMT]]></title><description><![CDATA[<p>Peter43 schrieb:</p>
<blockquote>
<p>Hm, ich bin etwas verwirrt, aber danke schonmal.</p>
<p>Meinst du sowas?</p>
<pre><code>#pragma pack(2)
</code></pre>
<p>falls ja, ist vorhanden.</p>
</blockquote>
<p>Ja, das meinte ich. Es würde ein anderes Padding erzeugen.</p>
<p>Woher Deins am Ende jeder Zeile kommt, lann ich mir nicht erklären.</p>
<p>Peter43 schrieb:</p>
<blockquote>
<p>Mir es geht hier um die Padding-Bits am Ende jeder Zeile des Bildes.</p>
</blockquote>
<p>Wie ist denn memblock_file erzeugt worden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2384314</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2384314</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Fri, 21 Feb 2014 00:18:31 GMT</pubDate></item><item><title><![CDATA[Reply to 24-bit bitmap erstellen on Fri, 21 Feb 2014 00:32:31 GMT]]></title><description><![CDATA[<p>Das kommt daher da in jeder Zeile des Bildes eine durch 4 teilebare Anzahl an Bytes steht, wenns nicht passt wird das nötige ergänzt.</p>
<p>Ich hätte memblock_file1 und memblock_file2 schreiben sollen, das erste wird ganz einfach mit Daten der input-File gefüllt, das zweite wird aus dem ersten erzeugt und an den Header angeängt der output-File angehängt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2384315</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2384315</guid><dc:creator><![CDATA[Peter43]]></dc:creator><pubDate>Fri, 21 Feb 2014 00:32:31 GMT</pubDate></item><item><title><![CDATA[Reply to 24-bit bitmap erstellen on Fri, 21 Feb 2014 00:34:06 GMT]]></title><description><![CDATA[<pre><code>char*memblock_file=new char[size];
</code></pre>
<p>so <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61b.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_tongue"
      title=":P"
      alt="😛"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2384316</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2384316</guid><dc:creator><![CDATA[Peter43]]></dc:creator><pubDate>Fri, 21 Feb 2014 00:34:06 GMT</pubDate></item><item><title><![CDATA[Reply to 24-bit bitmap erstellen on Fri, 21 Feb 2014 14:11:58 GMT]]></title><description><![CDATA[<p>Mein Fehler, auch bei bmp-Bildern die mit Paint o.a. erstellt werden sieht man in der txt-File, Header und Padding-Bytes!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2384421</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2384421</guid><dc:creator><![CDATA[Peter43]]></dc:creator><pubDate>Fri, 21 Feb 2014 14:11:58 GMT</pubDate></item><item><title><![CDATA[Reply to 24-bit bitmap erstellen on Fri, 21 Feb 2014 15:11:19 GMT]]></title><description><![CDATA[<p>Peter43 schrieb:</p>
<blockquote>
<p>Mein Fehler, auch bei bmp-Bildern die mit Paint o.a. erstellt werden sieht man in der txt-File, Header und Padding-Bytes!</p>
</blockquote>
<p>Natürlich sieht man die Padding-Bytes, die müssen ja immer da sein.</p>
<p>Bzw. ob man sie sieht oder nicht, hängt natürlich vom Editor und vom Wert der Bytes ab.<br />
Manche Texteditoren zeigen bestimmte Zeichen wohl nicht an (z.B. ASCII Codec 0-7).</p>
<p>Ich weiss jetzt nicht auswendig ob das BMP Format vorschreibt dass die Padding-Bytes immer 0 sein müssen. Wenn nicht kannst du dir ja zumindest aussuchen was du reinschreibst. Anbieten würden sich, wenn du die Files in nem Texteditor angucken willst, mMn. das Leerzeichen, &quot;~&quot; oder &quot;#&quot;.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2384440</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2384440</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Fri, 21 Feb 2014 15:11:19 GMT</pubDate></item></channel></rss>