0 Replies Latest reply on May 11, 2007 4:57 AM by GKHarrop66666

    efficiency of decoding and displaying image files?


      My question is this: can Flash Player download JPG and GIF files from a server and rapidly open/decode them, ready for display, efficiently and entirely 'in memory'?

      Would Flex be a good choice of language for developing a RIA that needs to continually download lots of JPG and GIF images on-the-fly from the server and render them on the screen? I *don't* want my application to thrash the hard disc.


      I am designing a 'rich' web app, and I'm investigating whether Flex is the right tool for the job.

      Although Flash's animation features are an obvious selling point for implementing my user interface, I also need to do some server-side rendering. What I want to do is perhaps a little unorthodox: I will be generating lots of GIF and JPG files on the fly and these will be streamed to the client (along with other application data, e.g. in XML format) to update different parts of the on-screen document. In need this to happen very quickly (in some cases, creating the effect of animation).

      It happens that JPGs and 16-colour GIFs will be, by far, the most efficient formats for streaming the images, because of the nature of the application. I could of course send the images in some proprietary format, geared for my application, but presumably decoding the images would be slow as I would have to implement this myself in ActionScript, and so I would be limited by the speed of Flex 'bytecode'. (I realise Flash is a lot more optimised than it once was, but I am hoping to see a gain from using image formats that Flash natively understands!)

      Naturally the internet bandwidth should (in principle) be the bottleneck. However, assuming I can get my image files to the client on time, want I want to know is: how efficient is Flash at loading such files? Bearing in mind that I'm not just displaying the occasional image -- I will be doing this continuously. Most of the images won't be huge, but there will be several separate images per second.

      The image files will be a mixture of normal colour JPGs and 4-bit colour GIFs (LZW-compressed). I know that Flash natively supports these formats, but depending on how Adobe have implemented their LZW/Huffman decoding and so on, and how much overhead there is in opening/processing downloaded image files before they are ready to 'blit' to the screen, I imagine this could be pretty fast or pretty slow!

      If my client only has a modest PC, I don't want the JPG/GIF decoding alone to be thrashing his CPU (or indeed the disc) before I've even got started on 'Flashy' vector stuff.

      I'm new to Flash, so are there any 'gotchas' I need to know about?

      E.g. Would it be fair to assume Flash Player will do the decoding of the downloaded image entirely 'in memory' without trying to do anything clever like caching the file to disc, or calling any libraries which might slow down the whole process? It would be no good at all if the images were first written to the client's hard disc before being ready to display, for example.

      Further, if I'm doing something a little out-of-the-ordinary, and there is no 'guarantee' that images will be loaded quickly, what I'm doing might be a bad idea if a later version of Flash Player may (for example) suddenly start doing some disc access in the process of opening a newly downloaded image. So, while I could just 'try it and see', what I really need is some assurance that what I'm doing is sensible and is likely to carry on working in future.

      Finally, I imagine JPG/GIF decoding could be something that would vary from platform to platform (e.g. for the sake of argument, Flash Player for Windows could use a highly-optimised library, but other versions could be very inefficient).

      This could be the 'make or break' of my application, so all advice is welcome! :) Thanks in advance.