Flash 8 BitmapExporter Class
Posted on 04. Apr, 2007 by lukesh in Flash Platform, Math and Information Theory, Technology and Science
Although this is essentially deprecated already, as you can easily export PNGs and JPEGs in AS3, this class allows you to encode a BitmapData object in AS2 so it can easily be accepted by a POST page or Web Service and converted to a PNG or JPEG on the server side.The class allows you to convert a BitmapData object from 24-bit to 16, 15, and 8-bit, and encode it as hex, or Unicode. For what we used the class for, we settled on 15-bit encoding to Unicode, with a 32-character offset. In other words, the color value for each 15-bit pixel, plus 32, is stored as the equivalent Unicode character. We needed the offset because there are some control characters that were causing some trouble. Decoding the string on the server side, at least in C#.NET, was relatively straightforward.
UPDATE: Click here to get the complete source, including the C# server-side code.
15 Responses to “Flash 8 BitmapExporter Class”
Trackbacks/Pingbacks
-
-
30. May, 2007
[...] Bitmaps por Quasimodo Bitmaps por Lukesh [...]

lee kulberda
05. Jun, 2007
Do you happen to have the code for the .NET app?
raul
14. Jun, 2007
can we see how do you decode the string on the server side???
Redhook
17. Jul, 2007
I also want to see how you decode the string on the server side using .net also
vandna
27. Jul, 2007
Hi,
Amazing stuff. I would love to see the C# code as well for decoding part.
Arran
17. Aug, 2007
Hi
Cool BitmapExporter class. Do you have to C# server-side ashx to parse the base64 back into a jpg.
Cheers
Arran
Dan
24. Aug, 2007
Hi Francis,
Great work. I was keen to play around with your bitmap exporter code. Is there any chance you could send me the c# .net side?
Thanks,
Dan.
Shannon
03. Sep, 2007
We have this similar thing implemented via Quasimodo php, but would love to see this in c# if possible??
Cheers!
Shannon
Shannon
05. Sep, 2007
I’ve figured it out for those who want to know. c# doesn’t exactly love the type conversions, so i’ve had to use a few Convert.To… function calls. if anyone has a better idea of how to do this, please let me know. The below is to decode and save using convert15to24 method.
Enjoy!
public void UploadImg(string strBitmap, int width, int height)
{
Bitmap bmp = new Bitmap(width, height);
for (int i = 0; i > 10) & 0x1F)) / 0x1F * 0xFF)) <> 5) & 0x1F)) / 0x1F * 0xFF)) <<
|
(Convert.ToInt32((Convert.ToDouble(((p)) & 0x1F)) / 0x1F * 0xFF))
);
}
Shannon
05. Sep, 2007
Doh!… the formatting is all mucked up… if you want the code, just email me.
lukesh
05. Sep, 2007
Your wish has been granted:
http://lukesh.wordpress.com/2007/09/05/full-bitmapexporter-source-released-under-open-source-license/
Arcangelo
17. Nov, 2007
I’ve dowload a zip file…. but t the Fla file is corrupt for flash8 editor
How can I do?
Thanks
lukesh
17. Nov, 2007
Arcangelo, the problem was that the FLA was saved for the Flash 9 IDE, even though it was an AS2 project. I have saved it as a Flash 8 file so you should be able to open it. Please re-download the ZIP file.
Madan Gopal Soni
07. Dec, 2007
Hi lukesh,
I found the source code for BitMapExporter in c# version.
Can you please tell me how to save bigger(2 MB) size image from flash to server.
I am facing the problem of error in opening the http://www.localhost/services/service.asmx.
have there any way to solve it.
it is working fine for 1050*1410 size parameter.
Thanks
Madan
Ashish Kumar
30. Sep, 2008
I see this live here, But it is not working
http://www.lucidcircus.net/wyeth2/
Please update the .zip source file also, Its showing error -
Final bitmap dimensions are: 366 x 368
Final string is [n] length: 134688
Completed in [n] milliseconds: 3630
Error opening URL “http://localhost/BitmapExporter/Service.asmx”
updatePreview FAULT
faultactor http://www.lucidcircus.net/wyeth2
faultNamespaceURI undefined
element undefined
detail undefined
faultstring Unable to connect to endpoint: http://localhost/BitmapExporter/Service.asmx
faultcode Server.Connection