Flash Question
- Started
- Last post
- 10 Responses
- clearThoughts
Right - this isn't a particularly Ground-Breaking as3/Pv3D question, but does anybody know how you achieve that effect where you load a pixelated JPG preview of an image and once the image is loaded you show the high-res image?
I thought it could be done loading a small image first and then replacing it with the real deal or alternatively using a progressive JPG....
Any thoughts??? I already Googled it but couldn't find anything on the subject, although I've seen it in a lot of sites. It's not even a new thing - I know.
- liveforever0
create the pixelation in photshop ?
then when the picture has loaded replace it with the hi-res version- prob best way and likely to rag the memory as if ur were doing it by ASliveforever
- hitsuji0
thats the way i'd do it too. there probably is an easier way to do it in actionscript but i don't know it.
- maximillion_0
you want to create this as an effect?
or you want the user to see a low res version until the high res loads?
- flashbender0
I've used the technique of scaling the small image up to the size of the high res, lading the high res in a background container (use of a load bar optional) and then when the high res is loaded using swapDepths / removeMovieClip to swap the the hi res for the low res with a swipe mask or something similar.
That is using AS2, so maybe there is a more legant way to do it in AS3, I don't know
for AS3, my quick search yeilded this:
http://books.google.co.uk/books?…- lading = loadingflashbender
- I'm no flash whizz, but scaling up a thumbnail gif is how I'd do it too.Nairn
- fyoucher10
I'd create a container that holds two containers, one for low res image, one for high res. When scaling, scale the parent container for both clips. When you need the high res version, load it into the high res container clip, and then fade it in (as Flashbender said). Use smoothing on the images.
There's probably a better way using a bitmapData object but I haven't thought about it much.
- acescence0
the flash player can't load progressive jpegs, different compression method than normal jpegs.
if you used bitmapdata to simulate a low res version, then the hi-res would already have to be loaded, wouldn't it?
maybe a shortcut would be to write a script that generates the low-res version on your server with php and gdlib
- NONEIS0
Sometimes the obvious method really is the best, just create 2 versions of each image (just batch the smaller ones in photoshop), but definitely do not turn smoothing on the smaller ones. It sounds like you want it to look pixelated, so use smoothing on the large ones, but not the small.
- acrossthesea0
Yeah I see possibilities with the 2 image switch, but I've seen it where they initially show you a super pixelated version, then the large pixels transition to their normal 1px size when the hi-res image appears to be done loading. I wonder if there's a way to show the lo-res version while the hires is loading.
I know you can get the size of a jpeg without loading it fully with this solution :
http://www.anttikupila.com/flash…Maybe you can get some kind of basic raw color data and work with that as the hires loads?
- by lo-res, I mean a generated pixelated version based on the hi-res, not a sep fileacrossthesea
- Pupsipu0
well the effect you're describing is achieved with a separate file.
If you want to skip through byte data of a high res file that's being loaded, say skip to every 10th pixel, get its color data and show that, you will still have to load the entire file, and it will take just as long.
The reason the size getting thing works is that data is in the beginning of the JPG, which means you can use it after a second of loading.
By not using a separate file for low-res preview, you're essentially doing regular html style progressive loading like here for flash http://www.onflex.org/ted/2007/1… but way more complicated, as you'd be skipping through pixels in a way that will depend on the size of each jpg.
And good luck clicking anything else while that's happening.
- clearThoughts0
Thanks for all the answers!
No - I don't mean as an 'effect', but as a preview while it's loading.
For example here - http://www.bonmagazine.com/#/ on any of the image galleries.Look like the only way is by creating a separate smaller image, and in that case the best way is to write a php script to generate the thumbnail - like acescence said