[Flash 8] PNG, JPEG, or GIF saving in AS via BitmapData?

Now that Flash 8 has introduced the BitmapData class allowing you to get at the invidiual pixels of an image among other things, it’s pretty trivial to ‘save’ an image to the server. Just gather up all the pixels and send them to a script that uses a graphics library to output them as a proper image (you could even add the headers to send it as a proper bitmap, I suppose…haven’t done it myself, yet)

But i’m wondering, has anyone gone one step further to do all the compression and building of a file with proper headers on the client-side in actionscript? (i.e. porting it from libpng, etc)

Now, I fully realize there would be little benefit to this:

  • Image libraries are commonly installed on a server
  • Even if all the work is done by the flash client, a script still has to recieve it

But, what it would allow is…

  • quicker uploading time of large images for people with slow connections (dial-up). for example, you could make a Flash oekaki board…those usually do the compression on the client, and I think people would whine if they didn’t
  • Compatibility with more hosts. all you would need is the ability to receive data and write files

I also realize that there’s coders out there who like to do things like this just to say “Hey, look what I can do!” (the emulation scene and demoscene being extereme examples of this…), so, i’m wondering if maybe someone has done it just for kicks, because they can

This second benefit specifically is what i’m looking for. I want to include this into my own program if possible, because I want to write a program that will be compatible with as many hosts as possible, provided they have at least the most basic server-side scripting available. Specifically, this should allow it to run on a wide range of free hosts, which nowadays often offer some watered down scripting abilities. Hell, it would even run on something like Tripod.com, which has basic perl support

…so, is it out there? I would like PNG saving if possible. I looked into doing it myself, I took a look at the libpng code in C, but I don’t think I have the skill in either language to tackle it. I did, of course, search it first too, but no luck…and since PNG, JPEG/JPG, and GIF are so common you get a big mess of results, too

(last note: I’ve posted this in a number of forums around the web, but no luck)