In October of 2005, Tinic Uro ported a PNG and a JPEG encoder to ActionScript 3. Shortly after, we added both to the collection of free ActionScript libraries on Adobe Labs. Tinic wrote them for an early alpha release of Flex Builder, so at some point along the line during the evolution of the compiler and the player, they stopped working.
I just checked in new versions of both that now compile and pass simple tests against the Flex 2 release. The PNG encoder is here, and the JPEG encoder is here. Let me know if you find any problems with them.

Thanks Christian, great work!
Nice. Not sure if you noticed, but James just posted an app that shows this in use:http://www.cayambe.com/wordpress/?p=66Great stuff._David
change all “int” to “Number”,it will faster
You can see Tinic’s encoding code in action on my Flex Derby project, Artmatic. http://matt-rix.com/fd/artmatic/Check it out, let me know what you think… I’m not even sure it works with the Flash 9 release player
Very cool but can you put these files up as usual download links? When trying to copy and paste the code, the formatting and tabs are completely messed up.
… Besides on Firefox it also copies the line numbers so it’s completely in vain.
Am I the only one getting errors with the JPGEncode class? Which didn’t appear to be updated in the latest flashplatform.zip. Is BitString still a class in AS3? I think that needs to be addressed for this to work properly.
Whats the deal? I’m trying to copy these classes now since a few days but it seems nobody took notice that they cannot be downloaded (I’m getting here.html). And copy/paste doesn’t work. In Firefox it copies the line numbers too and in IE the code is still messed up that not even Flash 9 Public Alpha can reformat it.Anyone cares to correct this?
For those of you having trouble getting Labs code, see this post:http://weblogs.macromedia.com/cantrell/archives/2006/08/how_to_get_code.cfmAll is explained.Christian
download works fine now! thxgreetz andreap.s.: next time call it a “download contest” and give hints like in an adventure game.working title: “distaction for the stressed out developer”
Very helpful. This stuff should be posted in more places. Also, more mention should be made of the as3corelib! This is very useful stuff.
At first I thought BitString doesnt seem to be valid AS3.What is going on here?But then I realised there is a BitString class next to the other adobe classes. (Jpeg and PNG)You can see the BitString class herehttp://labs.adobe.com/svn/flashplatform/?/projects/corelib/trunk/src/actionscript3/com/adobe/images/
I just completed a tutorial using the AS3 CoreLib JPGEncoder class. You can check it out at www[DOT]theliblab-tutorials[DOT]com.Any comments greatly appreciated