<?xml version="1.0" encoding="iso-8859-9" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwizguide.com/rss_namespace/">
 <channel>
  <title>Datakent Forum : C# Bitmap To Byte Array</title>
  <link>http://forum.datakent.com/</link>
  <description>XML içerik linki; Datakent Forum : C# &amp; ASP.NET : C# Bitmap To Byte Array</description>
  <pubDate>Thu, 30 Apr 2026 15:42:33 +0000</pubDate>
  <lastBuildDate>Sun, 19 Apr 2015 10:19:47 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.54</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.datakent.com/RSS_post_feed.asp?TID=2785</WebWizForums:feedURL>
  <image>
   <title>Datakent Forum</title>
   <url>http://forum.datakent.com/forum_images/datakent.com_forums.png</url>
   <link>http://forum.datakent.com/</link>
  </image>
  <item>
   <title>C# Bitmap To Byte Array : C# Bitmap To Byte Arrayprivate...</title>
   <link>http://forum.datakent.com/forum_posts.asp?TID=2785&amp;PID=5626#5626</link>
   <description>
    <![CDATA[<strong>Yazar:</strong> <a href="http://forum.datakent.com/member_profile.asp?PF=1" rel="nofollow">murat turan</a><br /><strong>Konu:</strong> 2785<br /><strong>Gönderim Zamanı:</strong> 19.Nisan.2015 Saat 10:19<br /><br /><div><b>C# Bitmap To Byte Array</b></div><div><br></div><div>private byte&#091;&#093; BitmapToByteArray(Bitmap xtmpBmp, bool addHader = false)</div><div>{</div><div>&nbsp; &nbsp; //byte donusumu sonrasi resim tam ters dondugu icin, onceden resmi ters donduruyorum</div><div>&nbsp; &nbsp; //haliyle islem sonrasi resim duz gelmis oluyor ;)</div><div>&nbsp; &nbsp; //ayrica &gt;&gt; &nbsp;addHader ile byte diziye BMP nin fiziksel diskteki header kismi ekleniyor !</div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; xtmpBmp.RotateFlip(RotateFlipType.Rotate180FlipX);</div><div><br></div><div>&nbsp; &nbsp; byte&#091;&#093; _bmpHeader = new byte&#091;&#093;{66, 77, 166, 229, 63, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, 0, 174,&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;8, 0, 0, 116, 2, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, 112, 229, 63, 0, 196,&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;14, 0, 0, 196, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};</div><div><br></div><div>&nbsp; &nbsp; BitmapData bmpdata = xtmpBmp.LockBits(new Rectangle(0, 0, xtmpBmp.Width, xtmpBmp.Height),&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; ImageLockMode.ReadOnly, xtmpBmp.PixelFormat);</div><div><br></div><div>&nbsp; &nbsp; int numbytes = bmpdata.Stride * xtmpBmp.Height;</div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; byte&#091;&#093; bytedata = new byte&#091;numbytes&#093;;</div><div>&nbsp; &nbsp; IntPtr ptr = bmpdata.Scan0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; Marshal.Copy(ptr, bytedata, 0, numbytes);</div><div><br></div><div>&nbsp; &nbsp; xtmpBmp.UnlockBits(bmpdata);</div><div><br></div><div>&nbsp; &nbsp; if (addHader)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; byte&#091;&#093; tmpbytedata = new byte&#091;bytedata.Length + _bmpHeader.Length&#093;;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; _bmpHeader.CopyTo(tmpbytedata, 0);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; bytedata.CopyTo(tmpbytedata, 54);//header bolumunun uzerine yazmamak icin 54 de basla !</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; return tmpbytedata;</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; else</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return bytedata;</div><div>&nbsp; &nbsp; }</div><div>}</div>]]>
   </description>
   <pubDate>Sun, 19 Apr 2015 10:19:47 +0000</pubDate>
   <guid isPermaLink="true">http://forum.datakent.com/forum_posts.asp?TID=2785&amp;PID=5626#5626</guid>
  </item> 
 </channel>
</rss>