<?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: BitmapData Average Colours</title>
	<atom:link href="http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata</link>
	<description>Art + Technology</description>
	<lastBuildDate>Thu, 06 Oct 2011 13:58:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Anonymous</title>
		<link>http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata/comment-page-3#comment-9787</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Fri, 22 Apr 2011 13:45:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.soulwire.co.uk/?p=165#comment-9787</guid>
		<description>[...]  [...]</description>
		<content:encoded><![CDATA[<p>[...]  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Jan Bijlsma</title>
		<link>http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata/comment-page-3#comment-9604</link>
		<dc:creator>Robert Jan Bijlsma</dc:creator>
		<pubDate>Wed, 30 Mar 2011 14:54:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.soulwire.co.uk/?p=165#comment-9604</guid>
		<description>isn&#039;t there an error in your drawing method... all is shifted one row to the right and down?
should your draw function not contain the loop (can&#039;t find your original source code anymore )

for (var i:int = 0; i &lt; arr.length; i++)
			{
					
					col = i % columns;
					
					_x = _w * col;
					_y =_h * row;
					
					_sprt.graphics.beginFill(arr[i]);
					_sprt.graphics.drawRect(_x, _y, _w, _h);
					_sprt.graphics.endFill();
					
				
					if ( col == columns - 1 ) row++;
				
			}</description>
		<content:encoded><![CDATA[<p>isn&#8217;t there an error in your drawing method&#8230; all is shifted one row to the right and down?<br />
should your draw function not contain the loop (can&#8217;t find your original source code anymore )</p>
<p>for (var i:int = 0; i &lt; arr.length; i++)<br />
			{</p>
<p>					col = i % columns;</p>
<p>					_x = _w * col;<br />
					_y =_h * row;</p>
<p>					_sprt.graphics.beginFill(arr[i]);<br />
					_sprt.graphics.drawRect(_x, _y, _w, _h);<br />
					_sprt.graphics.endFill();</p>
<p>					if ( col == columns &#8211; 1 ) row++;</p>
<p>			}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tip: Use AS3&#8242;s Histogram() method for color averaging</title>
		<link>http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata/comment-page-3#comment-9523</link>
		<dc:creator>Tip: Use AS3&#8242;s Histogram() method for color averaging</dc:creator>
		<pubDate>Mon, 07 Mar 2011 02:18:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.soulwire.co.uk/?p=165#comment-9523</guid>
		<description>[...] I&#8217;ve been reusing a simple method of finding the average color of a region, based on an often-used technique of looping over each pixel, grabbing the pixel&#8217;s color using [...]</description>
		<content:encoded><![CDATA[<p>[...] I&#8217;ve been reusing a simple method of finding the average color of a region, based on an often-used technique of looping over each pixel, grabbing the pixel&#8217;s color using [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Making the most of your toy robot (Part 3 of 4) – Object Detection &#124; Electric Pineapple</title>
		<link>http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata/comment-page-3#comment-8878</link>
		<dc:creator>Making the most of your toy robot (Part 3 of 4) – Object Detection &#124; Electric Pineapple</dc:creator>
		<pubDate>Thu, 18 Mar 2010 18:47:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.soulwire.co.uk/?p=165#comment-8878</guid>
		<description>[...] spot is a colored ring that can be averaged out and determined to be in a specific range. Using the technique outlined here by Justin Windle we have averaged out the ring color and can ask if the RGB values are in the range [...]</description>
		<content:encoded><![CDATA[<p>[...] spot is a colored ring that can be averaged out and determined to be in a specific range. Using the technique outlined here by Justin Windle we have averaged out the ring color and can ask if the RGB values are in the range [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata/comment-page-2#comment-680</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Mon, 23 Nov 2009 19:58:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.soulwire.co.uk/?p=165#comment-680</guid>
		<description>THANK YOU!!!  Found your site via Google.  Saved me a ton of headaches with my code on a project at work.  Was only getting the &quot;R&quot; or &quot;B&quot; of an image (not the whole image with all three colors combined).  Thank you thank you thank you!!!</description>
		<content:encoded><![CDATA[<p>THANK YOU!!!  Found your site via Google.  Saved me a ton of headaches with my code on a project at work.  Was only getting the &#8220;R&#8221; or &#8220;B&#8221; of an image (not the whole image with all three colors combined).  Thank you thank you thank you!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Collage Creator &#124; Flash Monkey</title>
		<link>http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata/comment-page-2#comment-679</link>
		<dc:creator>Collage Creator &#124; Flash Monkey</dc:creator>
		<pubDate>Sun, 22 Nov 2009 21:49:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.soulwire.co.uk/?p=165#comment-679</guid>
		<description>[...] I actually did a quick Google search for this one before I started writing it myself and found Justin Windle&#8217;s post which goes into detail about how this works. Once I had the color values I just compare them to [...]</description>
		<content:encoded><![CDATA[<p>[...] I actually did a quick Google search for this one before I started writing it myself and found Justin Windle&#8217;s post which goes into detail about how this works. Once I had the color values I just compare them to [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Median Cut &#171; GrgrDvrt</title>
		<link>http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata/comment-page-2#comment-678</link>
		<dc:creator>Median Cut &#171; GrgrDvrt</dc:creator>
		<pubDate>Wed, 18 Nov 2009 16:45:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.soulwire.co.uk/?p=165#comment-678</guid>
		<description>[...] couleurs d&#8217;une belle image, tu peux tout de suite aller chez soulwire voir ces articles: couleurs moyennes et extraire une palette de couleurs, c&#8217;est plus simple et ça marche mieux. Par contre tu vas [...]</description>
		<content:encoded><![CDATA[<p>[...] couleurs d&#8217;une belle image, tu peux tout de suite aller chez soulwire voir ces articles: couleurs moyennes et extraire une palette de couleurs, c&#8217;est plus simple et ça marche mieux. Par contre tu vas [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Case Study : ActionScript 3 Performance Optimization at Mike Chambers</title>
		<link>http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata/comment-page-2#comment-677</link>
		<dc:creator>Case Study : ActionScript 3 Performance Optimization at Mike Chambers</dc:creator>
		<pubDate>Tue, 13 Oct 2009 17:36:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.soulwire.co.uk/?p=165#comment-677</guid>
		<description>[...] an image, created by averaging the colors within that image. Upon searching on google, I found a very good solution over at soulwire.co.uk, which I will use as the base for creating the palette. I want to point out that the original code [...]</description>
		<content:encoded><![CDATA[<p>[...] an image, created by averaging the colors within that image. Upon searching on google, I found a very good solution over at soulwire.co.uk, which I will use as the base for creating the palette. I want to point out that the original code [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Who wins the award for most popular pixel? &#124; BLOG.RUEDAMINUTE&#62;COM</title>
		<link>http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata/comment-page-2#comment-676</link>
		<dc:creator>Who wins the award for most popular pixel? &#124; BLOG.RUEDAMINUTE&#62;COM</dc:creator>
		<pubDate>Fri, 02 Oct 2009 02:42:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.soulwire.co.uk/?p=165#comment-676</guid>
		<description>[...] Soulwire, a snippet that gets the average color in an [...]</description>
		<content:encoded><![CDATA[<p>[...] Soulwire, a snippet that gets the average color in an [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elliot Geno</title>
		<link>http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata/comment-page-2#comment-675</link>
		<dc:creator>Elliot Geno</dc:creator>
		<pubDate>Wed, 15 Jul 2009 18:44:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.soulwire.co.uk/?p=165#comment-675</guid>
		<description>There&#039;s a much easier way to find the average color of an area of pixels. It can streamline you code immensely, be more accurate, and be easy on your processor. First take your bitmapData for the bitmap you are sampling. Scale it down using a matrix... then blow it back up using a different matrix! The following essentially pixelates the image and blows it back up to fill the bitmap. Simply supply the function with a bitmap, the desired pixel width, and the desired pixel height. You can then sample each of those sections much easier.

&lt;code&gt;&lt;pre lang=&quot;actionscript&quot;&gt; [ function pixelate(bitmap:Bitmap,pixelWidth:Number,pixelHeight:Number):BitmapData {
	var pixelScaleX:Number=1/pixelWidth;//find scale
	var pixelScaleY:Number=1/pixelHeight;
	// shrink bitmap
	var smallBitmapData:BitmapData=new BitmapData(pixelScaleX*bitmap.width,pixelScaleY*bitmap.height,true,0x00000000);//create small bitmap
	var smallMatrix:Matrix=new Matrix();
	smallMatrix.scale(pixelScaleX,pixelScaleY);//physically scales the bitmap
	smallBitmapData.draw(bitmap,smallMatrix,new ColorTransform(),&quot;normal&quot;,new Rectangle(0,0,bitmap.width,bitmap.height),false);// get original bitmap at smaller size using the smallMatrix
	// enlarge bitmap
	var newBitmapData:BitmapData=new BitmapData(bitmap.width,bitmap.height,true,0x00000000);//create normal sized bitmap
	var newMatrix:Matrix=new Matrix();
	newMatrix.scale(bitmap.width/smallBitmapData.width,bitmap.height/smallBitmapData.height);
	newBitmapData.draw(smallBitmapData,newMatrix,new ColorTransform(),&quot;normal&quot;,new Rectangle(0,0,bitmap.width,bitmap.height),false);
	// return the new bitmap
	return newBitmapData;
} ] &lt;/pre&gt;&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>There&#8217;s a much easier way to find the average color of an area of pixels. It can streamline you code immensely, be more accurate, and be easy on your processor. First take your bitmapData for the bitmap you are sampling. Scale it down using a matrix&#8230; then blow it back up using a different matrix! The following essentially pixelates the image and blows it back up to fill the bitmap. Simply supply the function with a bitmap, the desired pixel width, and the desired pixel height. You can then sample each of those sections much easier.</p>
<p><code>
<pre lang="actionscript"> [ function pixelate(bitmap:Bitmap,pixelWidth:Number,pixelHeight:Number):BitmapData {
	var pixelScaleX:Number=1/pixelWidth;//find scale
	var pixelScaleY:Number=1/pixelHeight;
	// shrink bitmap
	var smallBitmapData:BitmapData=new BitmapData(pixelScaleX*bitmap.width,pixelScaleY*bitmap.height,true,0x00000000);//create small bitmap
	var smallMatrix:Matrix=new Matrix();
	smallMatrix.scale(pixelScaleX,pixelScaleY);//physically scales the bitmap
	smallBitmapData.draw(bitmap,smallMatrix,new ColorTransform(),"normal",new Rectangle(0,0,bitmap.width,bitmap.height),false);// get original bitmap at smaller size using the smallMatrix
	// enlarge bitmap
	var newBitmapData:BitmapData=new BitmapData(bitmap.width,bitmap.height,true,0x00000000);//create normal sized bitmap
	var newMatrix:Matrix=new Matrix();
	newMatrix.scale(bitmap.width/smallBitmapData.width,bitmap.height/smallBitmapData.height);
	newBitmapData.draw(smallBitmapData,newMatrix,new ColorTransform(),"normal",new Rectangle(0,0,bitmap.width,bitmap.height),false);
	// return the new bitmap
	return newBitmapData;
} ] </pre>
<p></code></p>
]]></content:encoded>
	</item>
</channel>
</rss>

