<?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>Shaun Smith &#187; resize</title>
	<atom:link href="http://shaun.boyblack.co.za/blog/tag/resize/feed/" rel="self" type="application/rss+xml" />
	<link>http://shaun.boyblack.co.za/blog</link>
	<description>Flex, Ruby, Mongo - London, UK</description>
	<lastBuildDate>Sat, 04 Feb 2012 17:39:55 +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>Image Resizing and Cropping Utility &#8211; AS3 Demo</title>
		<link>http://shaun.boyblack.co.za/blog/2008/08/29/image-resizing-and-cropping-utility-as3-demo/</link>
		<comments>http://shaun.boyblack.co.za/blog/2008/08/29/image-resizing-and-cropping-utility-as3-demo/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 12:56:28 +0000</pubDate>
		<dc:creator>shaun</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[resize]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=109</guid>
		<description><![CDATA[Just a little follow up to yesterday&#8217;s post. Kyle was kind enough to put together a little demo for the Display Utility and send it my way. I tweeked it to reduce the filesize a bit. Herewith, the demo, source and all: displayutildemo.zip Disclaimer: My Mac has probably thrown some .DS_Store files into the zip file. If you are a Windows user.. &#8220;suck it!&#8221; No, I&#8217;m just kidding. The best solution is to switch to OS X as soon as &#8230; <a href="http://shaun.boyblack.co.za/blog/2008/08/29/image-resizing-and-cropping-utility-as3-demo/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just a little follow up to <a title="Image Resizing and Cropping Utility - AS3" href="http://shaun.boyblack.co.za/blog/2008/08/29/image-resizing-and-cropping-utility/" target="_self">yesterday&#8217;s post</a>.</p>
<p><a title="Kyle Ward" href="http://www.kyleward.co.za/" target="_blank">Kyle</a> was kind enough to put together a little demo for the Display Utility and send it my way. I tweeked it to reduce the filesize a bit. Herewith, the demo, source and all:</p>
<p><a href="http://shaun.boyblack.co.za/blog/wp-content/uploads/2008/08/displayutildemo.zip">displayutildemo.zip</a></p>
<p>Disclaimer: My Mac has probably thrown some .DS_Store files into the zip file. If you are a Windows user.. &#8220;suck it!&#8221; No, I&#8217;m just kidding. The best solution is to switch to OS X as soon as you can: I promise you won&#8217;t regret it. Until you try to copy and merge two folders &#8211; at which point you will be amazed when your original folder gets wiped. Awesome! Apple, why oh why oh why? The best OS on the planet, with one of the biggest flaws imaginable!</p>
]]></content:encoded>
			<wfw:commentRss>http://shaun.boyblack.co.za/blog/2008/08/29/image-resizing-and-cropping-utility-as3-demo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image Resizing and Cropping Utility &#8211; AS3</title>
		<link>http://shaun.boyblack.co.za/blog/2008/08/29/image-resizing-and-cropping-utility/</link>
		<comments>http://shaun.boyblack.co.za/blog/2008/08/29/image-resizing-and-cropping-utility/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 23:53:38 +0000</pubDate>
		<dc:creator>shaun</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[resize]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=96</guid>
		<description><![CDATA[UPDATE: Aha, here we go, this looks much better: Fit Display Object Into Rectange UPDATE: Or check out CASA lib: http://casalib.org/ A day or two ago my man Kyle asked me if I knew of any good ActionScript image resizing utilities. I said &#8220;nay&#8221;, did a quick (and unsuccessful) search, and promptly forgot about it. This morning, however, I had to write some PHP to scale and crop images to fit inside fixed rectangles (for desktop downloads) and I remembered &#8230; <a href="http://shaun.boyblack.co.za/blog/2008/08/29/image-resizing-and-cropping-utility/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE</strong>: Aha, here we go, this looks much better: <a title="Fit Display Object Into Rectangle" href="http://blog.soulwire.co.uk/flash/actionscript-3/fit-a-displayobject-into-a-rectangle/">Fit Display Object Into Rectange</a><br />
<strong>UPDATE</strong>: Or check out CASA lib: <a title="CASAlib" href="http://casalib.org/">http://casalib.org/</a></p>
<p>A day or two ago my man <a title="Kyle Ward" href="http://www.kyleward.co.za/" target="_blank">Kyle</a> asked me if I knew of any good ActionScript image resizing utilities. I said &#8220;nay&#8221;, did a quick (and unsuccessful) search, and promptly forgot about it. This morning, however, I had to write some PHP to scale and crop images to fit inside fixed rectangles (for desktop downloads) and I remembered that I&#8217;d written something to do that very thing many years ago. I found my old code, tweaked it, and rolled it out.</p>
<p>This evening I decided to write an AS3 version &#8211; I&#8217;ll need it soon enough anyhow. Herewith, my Display Utility containing two static methods: resize(), and resizeAndCrop().</p>
<p>DisplayUtil.resize() will scale a DisplayObject to a target size, with an optional fourth parameter to determine whether the image should fit &#8220;inside&#8221; (default) or &#8220;outside&#8221; the target size. For example:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">var fitInside:Boolean = false;<br />
DisplayUtil.resize( pic, 400, 300, fitInside );</div></div>
<p>DisplayUtil.resizeAndCrop() will scale a DisplayObject to fit &#8220;outside&#8221; a target size and then crop off the excess (by setting a scrollRect on the DisplayObject). The optional fourth and fifth parameters determine how to align the crop (the area to keep &#8211; defaults to center, middle). For example:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">var ha:String = DisplayUtil.ALIGN_RIGHT;<br />
var va:String = DisplayUtil.ALIGN_BOTTOM;<br />
DisplayUtil.resizeAndCrop( pic, 400, 300, ha, va );</div></div>
<p>Download:</p>
<p><a href="http://shaun.boyblack.co.za/blog/wp-content/uploads/2008/08/displayutil1.zip">displayutil.zip</a></p>
<p>Disclaimer: I&#8217;m absolutely sure that someone has already written something to do this, but I couldn&#8217;t find anything easily (quickly) enough, and it was fun to write.</p>
<p><strong>UPDATE</strong>: Aha, here we go, this looks much better: <a title="Fit Display Object Into Rectangle" href="http://blog.soulwire.co.uk/flash/actionscript-3/fit-a-displayobject-into-a-rectangle/">http://blog.soulwire.co.uk/flash/actionscript-3/fit-a-displayobject-into-a-rectangle/</a><br />
<strong>UPDATE</strong>: Or check out CASA lib: <a title="CASAlib" href="http://casalib.org/">http://casalib.org/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://shaun.boyblack.co.za/blog/2008/08/29/image-resizing-and-cropping-utility/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>

