Dynamic JPEG Masking
Recently on Flashcoders the question came up if it is possible to mask JPEGs based on a color value, similar to GIFs where one color can be reserved for transparency. Well, I created a little application based on my image-to-pixelinfo script that demonstrates the possiblities. You can upload an image and pick a color range that should be masked or un-masked.
On my machine this runs faster than I expected first based on whats actually happening behind the scenes. The current approach I would call brute force attack: The code traverses line by line through the image and checks if the current pixel has a color in the mask range or not. If yes it draws a pixel-sized rectangle at that position. I use a tiny optimization already: Horizontally neighbored mask pixels are combined into one long rectangle. Still the optimum code that I could imagine would be a kind of tracing routine that follows the surface of the masked areas. The question is what would be faster and how to do that.
Posted at September 28, 2002 07:24 PM | Further reading
(concerning upload of JPEG)...That was very cool. I have a debate raging with friends of mine...would you settle it for me? The upload image part< does that actually upload an image from th users drive to a file on the server that Flash uses?? Could it be done any other way?
Just curious.
At the moment the upload takes a picture from the users harddrive, but it could also grab an image from an URL that you enter. Or it could search Google for some images. As long as it is a JPEG or PNG it can handle it.
I found a script (perl) that can wrap a non progressive JPEG to a SWF. But to use any JPEG or PNG is better.
I know about swift-generator. But he his to bulky for fast converts and got some bugs there.
Your converter is closed source I guess?
URL (jpeg2swf with perl): http://spv.virtualave.net/jpeg2swf/
Is it possible to get the source code of the upload script...?? Ive been looking for a script just like that... And i havent got the experience to make one myself...
Any chance on you posting the upload script? It would be much appreciated!!.
Any chance on you posting the upload script? It would be much appreciated!!.
how do you do pixel operations? or for that matter, dynamically load PNG images into flash. as far as i know neither of these are supported.
hi,
It's wonderful to hear that you've made a masking allowed background color specifying.
I tried to load a small jpg, followed your link "application". But can not load.
I would like to know more about your application. Can you tell me please?
Tuan Vo
Thanks for telling me. It looks like I accidently deleted on file. It should work again now.
I, too, would love to know how to facilitate uploading a binary image file, or for that matter any file, from a user's computer to a server, via Flash. Just like lots of other people on here, it would seem.
Oh indeed - thanks for telling me! I'll try to fix that ASAP.
Hi this is great how is this dynamic masking done though? is there a source for this???
As you see, this demo is three years old now. With Flash 8 you just have to use one filter to get this effect.
hi there! i was wondering if the source is available...