<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>System.Drawing/GDI+</title><link>http://forums.asp.net/150.aspx</link><description>Discuss manipulating and creating graphics using the System.Drawing namespace and GDI+.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Problem Saving .Png Format</title><link>http://forums.asp.net/thread/3256188.aspx</link><pubDate>Wed, 24 Jun 2009 19:21:52 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3256188</guid><dc:creator>IranianCuriousBoy</dc:creator><author>IranianCuriousBoy</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3256188.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=150&amp;PostID=3256188</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi&lt;/p&gt;
&lt;p&gt;Reason:The PNG implementation in &lt;code&gt;System.Drawing &lt;/code&gt;requires the use of a searchable stream, which &lt;code&gt;Response.OutputStream &lt;/code&gt;isn’t.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>Re: Problem Saving .Png Format</title><link>http://forums.asp.net/thread/3254682.aspx</link><pubDate>Wed, 24 Jun 2009 07:44:49 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3254682</guid><dc:creator>Ambran</dc:creator><author>Ambran</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3254682.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=150&amp;PostID=3254682</wfw:commentRss><description>&lt;p&gt;Hi Iranianboy&lt;/p&gt;&lt;p&gt;The solution is to use a Response.BinaryWrite like this:&lt;pre name="code" class="c-sharp"&gt;MemoryStream io = new MemoryStream();
bmp.Save(io, ImageFormat.Png);
Response.BinaryWrite( io.GetBuffer() );&lt;/pre&gt;&lt;br /&gt; Found it here: &lt;a href="http://www.velocityreviews.com/forums/t78540-generation-of-png-in-aspnet-failed.html"&gt;http://www.velocityreviews.com/forums/t78540-generation-of-png-in-aspnet-failed.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Good luck&lt;/p&gt;&lt;p&gt;Amit&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Problem Saving .Png Format</title><link>http://forums.asp.net/thread/3254459.aspx</link><pubDate>Wed, 24 Jun 2009 06:10:33 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3254459</guid><dc:creator>IranianCuriousBoy</dc:creator><author>IranianCuriousBoy</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3254459.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=150&amp;PostID=3254459</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi&lt;/p&gt;
&lt;p&gt;I create a Bitmap and when try to save it in png format there is an error. It says:&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "&gt;&lt;b&gt;Description: &lt;/b&gt;An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Exception Details: &lt;/b&gt;System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;There is no problem saving in gif or jpeg formats.&lt;/p&gt;
&lt;p&gt;and my code:&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;        // Create a new Bitmap object, 50 x 50 pixels in size
        Image canvas = new Bitmap(50, 50);
        // create an object that will do the drawing operations
        Graphics artist = Graphics.FromImage(canvas);
        // draw a few shapes on the canvas picture
        artist.Clear(Color.Lime);
        artist.FillEllipse(Brushes.Red, 3, 30, 30, 30);
        artist.DrawBezier(new Pen(Color.Blue, 3), 0, 0, 40, 15, 10, 35, 50, 50);
        // return the picture
        canvas.Save(Response.OutputStream, ImageFormat.Png);
        // now the drawing is done, we can discard the artist object
        artist.Dispose();
        // also the Bitmap
        canvas.Dispose();&lt;/pre&gt;&lt;pre class="c-sharp" name="code"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="c-sharp" name="code"&gt;Help please&lt;/pre&gt;&lt;pre class="c-sharp" name="code"&gt;Thanks&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>