Output JPG Image from Flash
With the new BitmapData class and PHP, we can output JPG images from Flash easily
Click here
The principal behind it is simple: Simply get all the pixel color values and pass them to php, and php will generate the JPG.
betaruce.com
M | T | W | T | F | S | S |
---|---|---|---|---|---|---|
« Jan | ||||||
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 |
With the new BitmapData class and PHP, we can output JPG images from Flash easily
Click here
The principal behind it is simple: Simply get all the pixel color values and pass them to php, and php will generate the JPG.
Comments RSS • TrackBack URI
thats interesting
Comment by Dominick — August 18, 2005 @ 9:39 pmFantastic! Will you be publishing the source? This is something I’ve wanted to do from Flash for a longtime - I’ve done it with Director/Shockwave before, but the ubiquity of the Flash plugin will make things much easier…
Comment by Kent — August 18, 2005 @ 10:12 pmbeta-testers can only publish swf samples online now….
Comment by betaruce — August 18, 2005 @ 10:52 pmI think after Flash 8 is officially issued, I will post the code out
Thanks, I’m looking forward to Flash 8, one because then I can play with it, and two because it looks like there’s going to be a wealth of source-code sharing too :>
Comment by Kent — August 19, 2005 @ 12:04 amI looked into this, too, the problem is that you get huge amounts of data, even with fairly small images. An image of 300*200 has 60000 pixels, a color value is 6 digits, which results in about 360kb of data. So unless you find a way to stream or compress data you need to keep your images small or have long waiting times. Have you found a good way to manage this?
Comment by Christoph — August 19, 2005 @ 12:17 amyes that’s right. Becoz my testing server has memory limit, I cannot even have a 300*300 image if I use this method. That’s why I finally choose 200*200. I’m thinking of a better way. What do you think?
Comment by betaruce — August 19, 2005 @ 12:59 amWell, we would just have to find a way to reduce data. Wikipedia has some good info on image compression, I have never looked into the topic though, seems pretty complex if you want to get good results. Who knows, maybe Flash 8 has some more tricks up its sleeve for this purpose.
Comment by Christoph — August 19, 2005 @ 7:16 ami will see if Flash 8 can do anything. Thanks for your comments
Comment by betaruce — August 19, 2005 @ 8:18 amI was working on this for a long time under Flash8.
Comment by Ali Tan Ucer — August 19, 2005 @ 10:29 amIt takes to much time to collect the information and compress it.
I guess we found the next item in the wish list.
i recently found out that, browsers can decompress GZIPED html or css files. This means Flash needs to have a basic compressor/decompressor build in. Like LZW or something.
Macromedia is neglecting the application possiblities of BitmapData > Upload scheme.
i’ve thought of a “stupid” way to do it.
Comment by betaruce — August 19, 2005 @ 4:38 pmsay e.g. i hv a 400*400 image on Flash
i make it 200*200 by BitmapData and Matrix, then output the pixels of this scaled image.
Then in php each pixel value was used for 4 times (to form a square of size 2*2), then we can hv a 400*400 image but decreased resolution…..
btw, actually the main problem is the transfer of data from flash to php as there’s too much data. so it seems to work if i first output these data into a txt file and then run the php which get the values from the txt file.
i will try this out later.
Comment by betaruce — August 19, 2005 @ 6:33 pmso are you currently outputting each pixel as a colour to php to build the image? I was wondering about the delay and the php file :>
So I guess I’m still waiting for my Export File function…
Comment by kent — August 19, 2005 @ 6:56 pmyes php need some time to process the data
Comment by betaruce — August 20, 2005 @ 12:29 amyet i think the delay is not so significant.