Sounds a bit like Run Length Encoding

Dave Mennenoh wrote:
Hi all, I've been working on allowing users to dowload a jpeg from a movieClip in AS2 and came up with a simple, yet novel compression idea, that's a bit like RLE but not quite.

Basically it is this - analyze the image pixel by pixel to get the hex color codes into an array. Then, make a new array the same length as the colors array, but filled with "" - so it's full of nulls. I then iterate the colors array and if the current color is the same as the previous color, I don't add it to the new array - otherwise I do.

So if I have: [ff, ff, ff, aa, ff, aa, aa, aa, aa] the new array would be [ff, , , aa, ff, aa, , , ]

It makes it easy to reconstruct too, and it's taken about 7 seconds off in my tests. Saving a 300x320 image went from about 26sec to now 19sec. It's not huge, but everything is something...



Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



--

Glen Pike
01736 759321
www.glenpike.co.uk <http://www.glenpike.co.uk>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to