awesome Juan, I think that post has what I'm looking for. thanks for the reference!
Jared On Mon, Jan 25, 2010 at 6:53 PM, Juan Pablo Califano < [email protected]> wrote: > Maybe it's not exactly what you're after, but here's a good method for > extracting a color palette from an image. You could possibly adapt it to > suit your needs or at least get some pointers. > > > http://blog.soulwire.co.uk/flash/actionscript-3/colourutils-bitmapdata-extract-colour-palette/ > > Cheers > Juan Pablo Califano > > 2010/1/25 jared stanley <[email protected]> > > > here are some examples of the > > > > previous block of code. > > > > <http://lab.freestyleinteractive.com/jared/bitmap/revival.html> > > http://lab.freestyleinteractive.com/jared/bitmap/heman.html > > http://lab.freestyleinteractive.com/jared/bitmap/thundercats.html > > > > it appears that the dominant color is showing, but it is > inconsistent(look > > at the end frame of the heman vid as an example) > > > > thanks to anyone who can help shed some light on this. > > > > Jared > > > > > > > > > > > > > > On Mon, Jan 25, 2010 at 5:28 PM, jared stanley <[email protected] > > >wrote: > > > > > Hey list - I have been trying to get the dominant pixel color of an > > image. > > > > > > I received this solution from someone, but I'm still not exactly sure > > what > > > flash is doing with this: > > > > > > > > > public static function GetColor(_bmd:BitmapData):uint{ > > > > > > var m: Matrix = new Matrix(); > > > m.scale( 1 / _bmd.width, 1 / _bmd.height); > > > var colorBmd:BitmapData = new BitmapData(1, 1); > > > colorBmd.draw(_bmd, m); > > > var color:uint = colorBmd.getPixel(0,0); > > > //trace(color) > > > > > > return color; > > > } > > > > > > > > > > > > - the matrix is scaling down _bmd to a fraction > > > - a 1x1 pixel BitmapData is created > > > - the draw() method is drawing a scaled version of the bitmap, > 1pixel > > > by 1 pixel > > > - the pixel at 0,0 is selected > > > > > > My question is how is that color determined? Basically the whole image > > gets > > > simplified down to one color by flash, how is that determined? > > > > > > Ultimately I'm curious as I'd like to be able to get the dominant color > > and > > > the average color of an image separately. > > > > > > Thanks! > > > > > > Jared > > > > > > > > _______________________________________________ > > Flashcoders mailing list > > [email protected] > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

