<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Create High Quality Thumbnail &#8211; Resize Image Dynamically &#8211; ASP .Net C# Code</title>
	<atom:link href="http://www.cosmocentral.com/2007/10/create-high-quality-thumbnail-resize-image-dynamically-asp-net-c-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cosmocentral.com/2007/10/create-high-quality-thumbnail-resize-image-dynamically-asp-net-c-code/</link>
	<description></description>
	<lastBuildDate>Tue, 03 May 2011 02:34:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Kelvin Sinha</title>
		<link>http://www.cosmocentral.com/2007/10/create-high-quality-thumbnail-resize-image-dynamically-asp-net-c-code/comment-page-1/#comment-6863</link>
		<dc:creator>Kelvin Sinha</dc:creator>
		<pubDate>Sat, 23 Oct 2010 14:12:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.webcosmoforums.com/cosmocentral/?p=36#comment-6863</guid>
		<description>awesome post man really gr8 code for thumbnail i need it badly.
fantastic tumbs up...</description>
		<content:encoded><![CDATA[<p>awesome post man really gr8 code for thumbnail i need it badly.<br />
fantastic tumbs up&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amit C.</title>
		<link>http://www.cosmocentral.com/2007/10/create-high-quality-thumbnail-resize-image-dynamically-asp-net-c-code/comment-page-1/#comment-5484</link>
		<dc:creator>Amit C.</dc:creator>
		<pubDate>Thu, 04 Jun 2009 11:27:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.webcosmoforums.com/cosmocentral/?p=36#comment-5484</guid>
		<description>Thanx for your reply manik but i have already tried it without using ImageFormat.Jpeg but still the problem persist. But atlast i get a solution after some brainstorming, i tried the Codec and eParams parameter of bitmap.save and get done....here is the code i have added in your original code...

 System.Drawing.Image image;
    image = System.Drawing.Image.FromFile(_path);
    int srcWidth = image.Width;
    int srcHeight = image.Height;
   /* explicity supply the thumbnail height and width so commented the code.
    //      if(srcHeight&gt;srcWidth)
    //      thumbHeight=(srcHeight/srcWidth)*thumbWidth;
    //      else
    //      thumbHeight=(srcWidth/srcHeight)*thumbWidth;


     System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(thumbWidth, (int)thumbHeight);



        //- Create a System.Drawing.Graphics object from the Bitmap which we will use to draw the high quality scaled image
        System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bitmap);

        //- Set the System.Drawing.Graphics object property SmoothingMode to HighQuality
        gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

        //- Set the System.Drawing.Graphics object property CompositingQuality to HighQuality
        gr.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;

        //- Set the System.Drawing.Graphics object property InterpolationMode to High
        gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;

        //- Draw the original image into the target Graphics object scaling to the desired width and height
        System.Drawing.Rectangle rectDestination = new System.Drawing.Rectangle(0, 0, thumbWidth, (int)thumbHeight);


        //Set Image codec of JPEG type, the index of JPEG codec is &quot;1&quot;

        System.Drawing.Imaging.ImageCodecInfo codec = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders()[1];



        //Set the parameters for defining the quality of the thumbnail... here it is set to 100%

        System.Drawing.Imaging.EncoderParameters eParams = new System.Drawing.Imaging.EncoderParameters(1);

        eParams.Param[0] = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
       
        gr.DrawImage(image, rectDestination, 0, 0, srcWidth, srcHeight, System.Drawing.GraphicsUnit.Pixel);

bitmap.Dispose();
image.Dispose();</description>
		<content:encoded><![CDATA[<p>Thanx for your reply manik but i have already tried it without using ImageFormat.Jpeg but still the problem persist. But atlast i get a solution after some brainstorming, i tried the Codec and eParams parameter of bitmap.save and get done&#8230;.here is the code i have added in your original code&#8230;</p>
<p> System.Drawing.Image image;<br />
    image = System.Drawing.Image.FromFile(_path);<br />
    int srcWidth = image.Width;<br />
    int srcHeight = image.Height;<br />
   /* explicity supply the thumbnail height and width so commented the code.<br />
    //      if(srcHeight&gt;srcWidth)<br />
    //      thumbHeight=(srcHeight/srcWidth)*thumbWidth;<br />
    //      else<br />
    //      thumbHeight=(srcWidth/srcHeight)*thumbWidth;</p>
<p>     System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(thumbWidth, (int)thumbHeight);</p>
<p>        //- Create a System.Drawing.Graphics object from the Bitmap which we will use to draw the high quality scaled image<br />
        System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bitmap);</p>
<p>        //- Set the System.Drawing.Graphics object property SmoothingMode to HighQuality<br />
        gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;</p>
<p>        //- Set the System.Drawing.Graphics object property CompositingQuality to HighQuality<br />
        gr.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;</p>
<p>        //- Set the System.Drawing.Graphics object property InterpolationMode to High<br />
        gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;</p>
<p>        //- Draw the original image into the target Graphics object scaling to the desired width and height<br />
        System.Drawing.Rectangle rectDestination = new System.Drawing.Rectangle(0, 0, thumbWidth, (int)thumbHeight);</p>
<p>        //Set Image codec of JPEG type, the index of JPEG codec is &#8220;1&#8243;</p>
<p>        System.Drawing.Imaging.ImageCodecInfo codec = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders()[1];</p>
<p>        //Set the parameters for defining the quality of the thumbnail&#8230; here it is set to 100%</p>
<p>        System.Drawing.Imaging.EncoderParameters eParams = new System.Drawing.Imaging.EncoderParameters(1);</p>
<p>        eParams.Param[0] = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);</p>
<p>        gr.DrawImage(image, rectDestination, 0, 0, srcWidth, srcHeight, System.Drawing.GraphicsUnit.Pixel);</p>
<p>bitmap.Dispose();<br />
image.Dispose();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: manik</title>
		<link>http://www.cosmocentral.com/2007/10/create-high-quality-thumbnail-resize-image-dynamically-asp-net-c-code/comment-page-1/#comment-5440</link>
		<dc:creator>manik</dc:creator>
		<pubDate>Wed, 03 Jun 2009 13:35:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.webcosmoforums.com/cosmocentral/?p=36#comment-5440</guid>
		<description>@Amit What if you don&#039;t use the ImageFormat.Jpeg on the bmp.Save? Please try that one. If it doesn&#039;t work feel free to post the code here, I would take a look.</description>
		<content:encoded><![CDATA[<p>@Amit What if you don&#8217;t use the ImageFormat.Jpeg on the bmp.Save? Please try that one. If it doesn&#8217;t work feel free to post the code here, I would take a look.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amit C.</title>
		<link>http://www.cosmocentral.com/2007/10/create-high-quality-thumbnail-resize-image-dynamically-asp-net-c-code/comment-page-1/#comment-5424</link>
		<dc:creator>Amit C.</dc:creator>
		<pubDate>Wed, 03 Jun 2009 05:28:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.webcosmoforums.com/cosmocentral/?p=36#comment-5424</guid>
		<description>Your code is really amazing code to generate high quality thumbnails. But i got a problem if i use

 context.Response.ContentType = &quot;image/Jpeg&quot;;
        bitmap.Save(context.Response.OutputStream, ImageFormat.Jpeg);

Images are still blurred i can send you the code if these line supports your code.

Please reply as soos as possible. 
Thanx</description>
		<content:encoded><![CDATA[<p>Your code is really amazing code to generate high quality thumbnails. But i got a problem if i use</p>
<p> context.Response.ContentType = &#8220;image/Jpeg&#8221;;<br />
        bitmap.Save(context.Response.OutputStream, ImageFormat.Jpeg);</p>
<p>Images are still blurred i can send you the code if these line supports your code.</p>
<p>Please reply as soos as possible.<br />
Thanx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: S. AMOL</title>
		<link>http://www.cosmocentral.com/2007/10/create-high-quality-thumbnail-resize-image-dynamically-asp-net-c-code/comment-page-1/#comment-1832</link>
		<dc:creator>S. AMOL</dc:creator>
		<pubDate>Thu, 26 Mar 2009 12:39:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.webcosmoforums.com/cosmocentral/?p=36#comment-1832</guid>
		<description>really useful post</description>
		<content:encoded><![CDATA[<p>really useful post</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eloa - Brazil</title>
		<link>http://www.cosmocentral.com/2007/10/create-high-quality-thumbnail-resize-image-dynamically-asp-net-c-code/comment-page-1/#comment-1547</link>
		<dc:creator>Eloa - Brazil</dc:creator>
		<pubDate>Fri, 13 Mar 2009 20:14:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.webcosmoforums.com/cosmocentral/?p=36#comment-1547</guid>
		<description>Helped me a lot.
Thank you!
Best regards.</description>
		<content:encoded><![CDATA[<p>Helped me a lot.<br />
Thank you!<br />
Best regards.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Renjitha.S</title>
		<link>http://www.cosmocentral.com/2007/10/create-high-quality-thumbnail-resize-image-dynamically-asp-net-c-code/comment-page-1/#comment-139</link>
		<dc:creator>Renjitha.S</dc:creator>
		<pubDate>Tue, 20 Jan 2009 05:44:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.webcosmoforums.com/cosmocentral/?p=36#comment-139</guid>
		<description>Hi Sir,
Thaks for your codings.I had implemented it
thank you so much
Regards</description>
		<content:encoded><![CDATA[<p>Hi Sir,<br />
Thaks for your codings.I had implemented it<br />
thank you so much<br />
Regards</p>
]]></content:encoded>
	</item>
</channel>
</rss>

