<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>theDeSilva.com&#187; image height</title>
	<atom:link href="http://www.thedesilva.com/tag/image-height/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thedesilva.com</link>
	<description>Andrew de Silva</description>
	<lastBuildDate>Tue, 26 Apr 2011 20:24:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Resize image using VB.NET</title>
		<link>http://www.thedesilva.com/2010/01/resize-image-using-vb-net/</link>
		<comments>http://www.thedesilva.com/2010/01/resize-image-using-vb-net/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 19:35:39 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[image height]]></category>
		<category><![CDATA[image width]]></category>
		<category><![CDATA[resize image]]></category>
		<category><![CDATA[VB]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=178</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//VisualStudio_small.png" width="60" height="60" alt="" title=".NET" /><br/>Here&#8217;s a quick function to resize image using VB.NET 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Sub ResizeImage&#40;ByVal dir As String, ByVal fileName As String, ByVal percentResize As Double&#41; 'following code resizes picture [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//VisualStudio_small.png" width="60" height="60" alt="" title=".NET" /><br/><p>Here&#8217;s a quick function to resize image using VB.NET</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">Sub</span> ResizeImage<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> <span style="color: #0600FF;">dir</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, <span style="color: #FF8000;">ByVal</span> fileName <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, <span style="color: #FF8000;">ByVal</span> percentResize <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Double</span><span style="color: #000000;">&#41;</span>
        <span style="color: #008080; font-style: italic;">'following code resizes picture to fit</span>
&nbsp;
        <span style="color: #0600FF;">Dim</span> bm <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Bitmap<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;C:\&quot;</span> <span style="color: #008000;">&amp;</span> <span style="color: #0600FF;">dir</span> <span style="color: #008000;">&amp;</span> <span style="color: #808080;">&quot;\&quot;</span> <span style="color: #008000;">&amp;</span> fileName<span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #0600FF;">Dim</span> <span style="color: #0600FF;">width</span> <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> <span style="color: #008000;">=</span> bm.<span style="color: #0600FF;">Width</span> <span style="color: #008000;">-</span> <span style="color: #000000;">&#40;</span>bm.<span style="color: #0600FF;">Width</span> <span style="color: #008000;">*</span> percentResize<span style="color: #000000;">&#41;</span> <span style="color: #008080; font-style: italic;">'image width. </span>
&nbsp;
        <span style="color: #0600FF;">Dim</span> height <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> <span style="color: #008000;">=</span> bm.<span style="color: #0000FF;">Height</span> <span style="color: #008000;">-</span> <span style="color: #000000;">&#40;</span>bm.<span style="color: #0000FF;">Height</span> <span style="color: #008000;">*</span> percentResize<span style="color: #000000;">&#41;</span>  <span style="color: #008080; font-style: italic;">'image height</span>
&nbsp;
        <span style="color: #0600FF;">Dim</span> thumb <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Bitmap<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">width</span>, height<span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #0600FF;">Dim</span> g <span style="color: #FF8000;">As</span> Graphics <span style="color: #008000;">=</span> Graphics.<span style="color: #0000FF;">FromImage</span><span style="color: #000000;">&#40;</span>thumb<span style="color: #000000;">&#41;</span>
&nbsp;
        g.<span style="color: #0000FF;">InterpolationMode</span> <span style="color: #008000;">=</span> Drawing2D.<span style="color: #0000FF;">InterpolationMode</span>.<span style="color: #0000FF;">HighQualityBicubic</span>
&nbsp;
        g.<span style="color: #0000FF;">DrawImage</span><span style="color: #000000;">&#40;</span>bm, <span style="color: #FF8000;">New</span> Rectangle<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span>, <span style="color: #0600FF;">width</span>, height<span style="color: #000000;">&#41;</span>, <span style="color: #FF8000;">New</span> Rectangle<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span>, bm.<span style="color: #0600FF;">Width</span>, _
bm.<span style="color: #0000FF;">Height</span><span style="color: #000000;">&#41;</span>, GraphicsUnit.<span style="color: #0000FF;">Pixel</span><span style="color: #000000;">&#41;</span>
&nbsp;
        g.<span style="color: #0000FF;">Dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
        bm.<span style="color: #0000FF;">Dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">'image path.</span>
        thumb.<span style="color: #0000FF;">Save</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;C:\&quot;</span> <span style="color: #008000;">&amp;</span> <span style="color: #0600FF;">dir</span> <span style="color: #008000;">&amp;</span> <span style="color: #808080;">&quot;\&quot;</span> <span style="color: #008000;">&amp;</span> fileName, _
System.<span style="color: #0000FF;">Drawing</span>.<span style="color: #0000FF;">Imaging</span>.<span style="color: #0000FF;">ImageFormat</span>.<span style="color: #0000FF;">Jpeg</span><span style="color: #000000;">&#41;</span> <span style="color: #008080; font-style: italic;">'can use any image format </span>
&nbsp;
        thumb.<span style="color: #0000FF;">Dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></td></tr></table></div>

<p>To use the code all you have to do is to pass in the directory of the image , the file name and the percentage of increase / decrease that you would like. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2010/01/resize-image-using-vb-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

