Why is the ImageSnapshot class not in Flash? Taking steps to get big images out of Flash.

I don’t know if I really have a good post here, just want to know why a very useful, very powerful class that is in the Flex framework isn’t in Flash’s AS3 classes. For those of you who are Flash users but not Flex developers, you may not really know about this class (good explanation here, at Doug McCune’s blog.), but it acts as a shortcut/helper class to assist you when creating snapshots out of display objects or anything that implements IBitmapDrawable. It’s pretty nice.

One thing that this class does that is especially cool is let you get around the 2880×2880 pixel limit imposed on all Flash display objects, including our good friends Bitmap and BitmapData. I have been working around trying to get higher res images out of some of my comps lately and I have all but given up using Flash for it. Even when you run Flash through as an AIR app, and use sneaky tricks like employing AS3Corelib (which is a great selection of classes, I might add) to encode a container sprite as JPG or PNG and output them as files to your local machine you are still limited to the 2880 ceiling. Now, I have seen explanations on why the limit exists, and yes, it makes sense for web apps, but if you are already creating a signed or even an unsigned app for that matter that has to run as administrator on a machine, I see no reason why the 2880 ceiling exists. With monitors gaining pixels with every generation, I’m sure this will change someday, but hey… I’m impatient. No really, I am… ask my wife. ;-)

So then I was doing something like this linked example to get around it. You can use the numbers on your keyboard to move the canvas around. “C” toggles mouse visibility, “1″ moves the sprite back to it’s origin point, “2″ slides everything left by a bunch of pixels (I have a MacBook Pro, so it’s slightly less than 1440), “3″ moves everything to the right by the same amount, “4″ moves everything down by 600, “5″ moves up by 600… you see where I am going with this? I move the canvas, take the screenshot and then stitch them together in Photoshop. This allows me to get a pretty big canvas. But, it’s a pain. To get a 10k x 10k image (something that will give you a nice 2-3 foot size print) takes dozens of images. So I thought back to some stuff I have been playing with in Flex (more on that in an upcoming post) and want to do the same here. But that requires the ImageSnapshot class which is missing from Flash CS3… hmm. How vexing.

So, now, I’m currently planning on making a Flex developed app that will be deployed as AIR that will take an input SWF, allow you to set your dimensions and DPI and then use the imageSnapshot class to get a big fat uncompressed image out of it. ImageSnapshot supports up to 8192×8192 images of around 256meg. Has anyone seen an app like this around already? I certainly don’t like duplicating efforts as free time is at a premium. Thoughts?

Related to this post… I’m getting curiouser and curiouser as to why AIR doesn’t have a PDF encoder (especially since blazePDF is dead and is only AS2). I know I could find some uses for it. Postscript charts and elements from Flex or Flash anyone? Sounds nice. Especially with all the great work being done over at Degrafa, and the rumblings of the mx:Graphics stuff to come in Flex 4.

Posted on


  1. Adrian Parr Apr 21

    Hi Chad,

    That AIR app you’re thinking of making would be pretty popular. I haven’t seen anything like it before. You get my vote for making it. :-)


  2. Darren Daz Cox Apr 22

    I’d like to see the image across the whole screen when I maximize my screen. The margins of the blog make 1/3 of my screen empty and 2/3 the picture!

  3. Mike Apr 22

    Hi Chad,

    I have all ready developed a rough version of what you mention. My approach, in a nutshell, is to scale (depending on the output required), mask and render movieclips to a bitmap tile (small e.g. 400×400 pixels), send each tile to your desktop (take your pick – via a server or via AIR) and then stitch the tiles together using ImageMagick. That way you can get out images as large as you want (I’ve only tested to around 12,000×12,000 pixels – haven’t really pushed it). Only limits seem to be effects which a) die when you have large (in area) movieclips and b) crash Flash if you try to render too many movieclips with effects at once. You can get around b) by compositing the movieclips onto the one bitmap (think layers).

    I intend put out an app/package to make this all easy soon – probably happen in the next couple of months or so.

  4. Mitch Apr 28

    Hey Chad, a very interesting read that was. Many thanks for sharing.

    Maybe you might be able to help me with an issue Im having..

    Hey all,

    I’m currently building an AS3 air app which loads in metadata for all flvs in a directory into a list component.

    This works fine but because I want this to be totally dynamic I would like to also code in functions to take a snapshot of the 1st frame of the flvs in my list so it looks more plesant than just metadata text.

    I’ve read about 4 tutorials about how to create a snapshot of a loaded flv at runtime however none of these have worked. I even referenced 2 professional AS3 video books on how to do this but again the code didnt work either.

    It seems you have accomplised something similar above. If you could point me in the right direction or to any links you know of to learn how to do this that would be great!

    Much appreciated

  1. SWFShot v0.1 Released. Save Images of SWFs Greater Than 2880 Pixels | Visualrinse | Design and Development by Chad Udell

Leave a reply