<?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: Image Resizing in C#</title>
	<atom:link href="http://kossovsky.net/index.php/2009/06/image-resizing/feed/" rel="self" type="application/rss+xml" />
	<link>http://kossovsky.net/index.php/2009/06/image-resizing/</link>
	<description>C# Code Snippets, ASP.NET Code Samples, .NET Tips and Tricks</description>
	<lastBuildDate>Tue, 31 Jan 2012 06:04:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: George</title>
		<link>http://kossovsky.net/index.php/2009/06/image-resizing/comment-page-1/#comment-7224</link>
		<dc:creator>George</dc:creator>
		<pubDate>Thu, 21 Apr 2011 10:52:24 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=5#comment-7224</guid>
		<description>&lt;a href=&quot;#comment-414&quot; rel=&quot;nofollow&quot;&gt;@Tony Brand &lt;/a&gt; 

System.Drawing.Image test_image = System.Drawing.Image.FromFile(Server.MapPath(“images.jpg”));
System.Drawing.Image final_image = test_image.Resize(500, 500);
final_image.Save(Server.MapPath(“images/resized_image.jpg”));</description>
		<content:encoded><![CDATA[<p><a href="#comment-414" rel="nofollow">@Tony Brand </a> </p>
<p>System.Drawing.Image test_image = System.Drawing.Image.FromFile(Server.MapPath(“images.jpg”));<br />
System.Drawing.Image final_image = test_image.Resize(500, 500);<br />
final_image.Save(Server.MapPath(“images/resized_image.jpg”));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George</title>
		<link>http://kossovsky.net/index.php/2009/06/image-resizing/comment-page-1/#comment-7223</link>
		<dc:creator>George</dc:creator>
		<pubDate>Thu, 21 Apr 2011 10:50:51 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=5#comment-7223</guid>
		<description>@Tony Brand

System.Drawing.Image test_image = System.Drawing.Image.FromFile(Server.MapPath(&quot;images.jpg&quot;));

System.Drawing.Image final_image = test_image.Resize(500, 500);

final_image.Save(Server.MapPath(&quot;images/resized_image.jpg&quot;));</description>
		<content:encoded><![CDATA[<p>@Tony Brand</p>
<p>System.Drawing.Image test_image = System.Drawing.Image.FromFile(Server.MapPath(&#8220;images.jpg&#8221;));</p>
<p>System.Drawing.Image final_image = test_image.Resize(500, 500);</p>
<p>final_image.Save(Server.MapPath(&#8220;images/resized_image.jpg&#8221;));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George</title>
		<link>http://kossovsky.net/index.php/2009/06/image-resizing/comment-page-1/#comment-7222</link>
		<dc:creator>George</dc:creator>
		<pubDate>Thu, 21 Apr 2011 10:50:31 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=5#comment-7222</guid>
		<description>System.Drawing.Image test_image = System.Drawing.Image.FromFile(Server.MapPath(&quot;images.jpg&quot;));

System.Drawing.Image final_image = test_image.Resize(500, 500);

final_image.Save(Server.MapPath(&quot;images/resized_image.jpg&quot;));</description>
		<content:encoded><![CDATA[<p>System.Drawing.Image test_image = System.Drawing.Image.FromFile(Server.MapPath(&#8220;images.jpg&#8221;));</p>
<p>System.Drawing.Image final_image = test_image.Resize(500, 500);</p>
<p>final_image.Save(Server.MapPath(&#8220;images/resized_image.jpg&#8221;));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George</title>
		<link>http://kossovsky.net/index.php/2009/06/image-resizing/comment-page-1/#comment-7221</link>
		<dc:creator>George</dc:creator>
		<pubDate>Thu, 21 Apr 2011 10:25:52 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=5#comment-7221</guid>
		<description>@Matjaz: hi frnd, Change Int64 to System.Int64</description>
		<content:encoded><![CDATA[<p>@Matjaz: hi frnd, Change Int64 to System.Int64</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xander</title>
		<link>http://kossovsky.net/index.php/2009/06/image-resizing/comment-page-1/#comment-3827</link>
		<dc:creator>Xander</dc:creator>
		<pubDate>Tue, 11 May 2010 18:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=5#comment-3827</guid>
		<description>&lt;a href=&quot;#comment-3825&quot; rel=&quot;nofollow&quot;&gt;@Matjaz &lt;/a&gt;
The Quality category specifies the level of compression for an image. When used to construct an EncoderParameter, the range of useful values for the quality category is from 0 to 100. The lower the number specified, the higher the compression and therefore the lower the quality of the image. Zero would give you the lowest quality image and 100 the highest.

&lt;a alt=&quot;MSDN - Encoder.Quality&quot; target=&quot;_blank&quot; href=&quot;http://msdn.microsoft.com/en-us/library/system.drawing.imaging.encoder.quality.aspx&quot; rel=&quot;nofollow&quot;&gt;MSDN - Encoder.Quality&lt;a/&gt;</description>
		<content:encoded><![CDATA[<p><a href="#comment-3825" rel="nofollow">@Matjaz </a><br />
The Quality category specifies the level of compression for an image. When used to construct an EncoderParameter, the range of useful values for the quality category is from 0 to 100. The lower the number specified, the higher the compression and therefore the lower the quality of the image. Zero would give you the lowest quality image and 100 the highest.</p>
<p><a alt="MSDN - Encoder.Quality" target="_blank" href="http://msdn.microsoft.com/en-us/library/system.drawing.imaging.encoder.quality.aspx" rel="nofollow">MSDN &#8211; Encoder.Quality<a /></a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matjaz</title>
		<link>http://kossovsky.net/index.php/2009/06/image-resizing/comment-page-1/#comment-3825</link>
		<dc:creator>Matjaz</dc:creator>
		<pubDate>Tue, 11 May 2010 11:27:40 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=5#comment-3825</guid>
		<description>Thanks, i spent a lot of time searching for some good code to do image resize.

I have only one question:
What is Int64 Quality attribute for saving images. Which value should i set for this parameter?</description>
		<content:encoded><![CDATA[<p>Thanks, i spent a lot of time searching for some good code to do image resize.</p>
<p>I have only one question:<br />
What is Int64 Quality attribute for saving images. Which value should i set for this parameter?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tyson</title>
		<link>http://kossovsky.net/index.php/2009/06/image-resizing/comment-page-1/#comment-3798</link>
		<dc:creator>Tyson</dc:creator>
		<pubDate>Mon, 03 May 2010 02:01:12 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=5#comment-3798</guid>
		<description>Thank you, excellent</description>
		<content:encoded><![CDATA[<p>Thank you, excellent</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Radderz</title>
		<link>http://kossovsky.net/index.php/2009/06/image-resizing/comment-page-1/#comment-3283</link>
		<dc:creator>Radderz</dc:creator>
		<pubDate>Tue, 02 Feb 2010 13:48:43 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=5#comment-3283</guid>
		<description>This extender is really useful, thanks.

I&#039;ve been struggling with resizing and maintaining the image quality while using the .net framework, and nearly resorted to a library that was a bit overkill.

Glad I found this in time :)</description>
		<content:encoded><![CDATA[<p>This extender is really useful, thanks.</p>
<p>I&#8217;ve been struggling with resizing and maintaining the image quality while using the .net framework, and nearly resorted to a library that was a bit overkill.</p>
<p>Glad I found this in time <img src='http://kossovsky.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jo0ls</title>
		<link>http://kossovsky.net/index.php/2009/06/image-resizing/comment-page-1/#comment-1732</link>
		<dc:creator>jo0ls</dc:creator>
		<pubDate>Fri, 09 Oct 2009 09:25:28 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=5#comment-1732</guid>
		<description>Encoder.Quality doesn&#039;t do anything with Gifs.</description>
		<content:encoded><![CDATA[<p>Encoder.Quality doesn&#8217;t do anything with Gifs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony Brand</title>
		<link>http://kossovsky.net/index.php/2009/06/image-resizing/comment-page-1/#comment-415</link>
		<dc:creator>Tony Brand</dc:creator>
		<pubDate>Wed, 19 Aug 2009 15:50:52 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=5#comment-415</guid>
		<description>Hi

Thanks for the example. I just wanted to get the image resizing working, and wrote the following function after seeing your code:

public System.Drawing.Image ResizeImage(System.Drawing.Image originalImage, int Width, int Height, InterpolationMode InterpolationMode)  
    {
        System.Drawing.Image CropedImage = new Bitmap(Width, Height);  
        using (Graphics G = Graphics.FromImage(CropedImage))  
        {  
            G.SmoothingMode = SmoothingMode.HighQuality;  
            G.InterpolationMode = InterpolationMode;  
            G.PixelOffsetMode = PixelOffsetMode.HighQuality;
            G.DrawImage(originalImage, 0, 0, Width, Height);  
        }  

        return CropedImage;  
    }

I then save the returned image, e.g.: ResizeImage(image).Save(&quot;C:/Documents/Images/ResizedImage.jpg&quot;);

I am finding though that the saved image is somehow not valid, it does not open in Internet Explorer, or Fireworks (get error message: &quot;Could not open the file. Unknown file type&quot;), although it does open and looks fine in FireFox and Safari.

I have had the same problem trying a number of examples using the Graphics.DrawImage() method. Do you know anything about this problem? Perhaps there are some extra settings that need to be made?

Thanks again, any help would be appreciated</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>Thanks for the example. I just wanted to get the image resizing working, and wrote the following function after seeing your code:</p>
<p>public System.Drawing.Image ResizeImage(System.Drawing.Image originalImage, int Width, int Height, InterpolationMode InterpolationMode)<br />
    {<br />
        System.Drawing.Image CropedImage = new Bitmap(Width, Height);<br />
        using (Graphics G = Graphics.FromImage(CropedImage))<br />
        {<br />
            G.SmoothingMode = SmoothingMode.HighQuality;<br />
            G.InterpolationMode = InterpolationMode;<br />
            G.PixelOffsetMode = PixelOffsetMode.HighQuality;<br />
            G.DrawImage(originalImage, 0, 0, Width, Height);<br />
        }  </p>
<p>        return CropedImage;<br />
    }</p>
<p>I then save the returned image, e.g.: ResizeImage(image).Save(&#8220;C:/Documents/Images/ResizedImage.jpg&#8221;);</p>
<p>I am finding though that the saved image is somehow not valid, it does not open in Internet Explorer, or Fireworks (get error message: &#8220;Could not open the file. Unknown file type&#8221;), although it does open and looks fine in FireFox and Safari.</p>
<p>I have had the same problem trying a number of examples using the Graphics.DrawImage() method. Do you know anything about this problem? Perhaps there are some extra settings that need to be made?</p>
<p>Thanks again, any help would be appreciated</p>
]]></content:encoded>
	</item>
</channel>
</rss>

