Big Ass Bitmaps in Flash 10
Sunday 24 August 2008 - Filed under Flash
I remember reading, I think possibly on Tinic’s blog, a while back that BitmapData maximum sizes would be increasing. Then I heard Jim Corbett mention it at FiTC this year, along with some details. I know I could probably find the specs in writing somewhere, but I decided to test it out myself. And then blog it so I’ll know where to find it in the future.
It’s a bit more complex than Flash 8/9 constraints, which is simply a maximum size of 2,880 x 2,880, for a total pixel count of 8,294,400. We get more than twice the number of pixels to play with, but we also get some more freedom in how to use them.
So, the maximum pixel count is now 16,777,215. You might recognize that as the decimal equivalent of 0xFFFFFF. So, if you are looking for a square bitmap, the largest one you can make is 4,095 x 4,095, which results in 16,769,025 pixels. If you try to go to 4,096 x 4,096, you wind up with 16,775,216 pixels and an invalid bitmap FAIL. So not bad, that’s an extra 1,200-something pixels in each dimension.
But it’s actually better than that. Like I said, there’s more flexibility. You can actually go up to 8,191 pixels in either width OR height, as long as the total number of pixels stays under the limit. This means that you can have a bitmap up to 8,191 x 2,048 (or 2,048 x 8,191), which amounts to 16,775,168 pixels.
Now, that’s a bit much to try to visualize, so here’s a graphic to help you along:

This shows the maximum Flash 8/9 bitmap size, along with the maximum square and rectangular sized bitmaps in Flash 10. Cheers! Now get out there and crash some browsers!
2008-08-24 » keith
25 August 2008 @ 12:43 am
Interesting. You can have almost as many pixels as there are colours in the rgb format… I wonder what a sheet of that would look like…
25 August 2008 @ 1:57 am
That’s tight, it really reminds me of Microsoft’s new image viewing thing, with the SUPER high resolution pictures. It’s just insane.
Check out my blog about AS3.0, making games, and selling them! http://flashdevz.wordpress.com
25 August 2008 @ 2:49 am
>> Now get out there and crash some browsers!
What do you mean? 4095x4095x4 (4 = 32 bits) is only 64 megabytes…
25 August 2008 @ 5:48 am
some one rember the age of the 800×600 games in DOS?
25 August 2008 @ 3:21 pm
If you are super curious like me and want to know which sizes hit 16,777,215 pixels exactly here they are:
2169 x 7735
3133 x 5355
3315 x 5061
3615 x 4641
4095 x 4097
4097 x 4095
4641 x 3615
5061 x 3315
5355 x 3133
7735 x 2169
And if you are super dorky you would use flash to figure all this out for you:
var maxPix:uint = 16777215;
var maxSize:uint = 8191;
for (var i:uint = 1; i < maxSize; i++)
{
var n:Number = maxPix / i;
if (n == int(n) && n <= maxSize)
{
trace(i+” x “+n);
}
}
25 August 2008 @ 3:33 pm
Tim, nice! I was thinking about that myself, but was a couple dork points short of actually doing it.
26 August 2008 @ 10:04 am
Wow Tim, you read my mind. I thought I was the only super dorky one.
I too will award you a couple of points, for showing your workings.
26 August 2008 @ 12:13 pm
what a bout printing on a bitmap canvasses array ? it is easy but not so powerfull if yu do not use falsh as3.
So (hoping that flash player 10 will not be “cutted” somwere)wen i will use a canvas in flash cs3 I will create the same array of canvasses i suse now in flash as2 but a little more bigger … that’s all.
I cannot think about all the app i can code.
I make a try.
http://www.nicolamarini.it/Art/Painting/BlodLineLove/BlodLineLove.html
and then make a couplle of try
http://www.nicolamarini.it/Art/War/War.html
(this one is BIG in print… i reduced for web)
26 August 2008 @ 8:37 pm
This is great news!
Interestingly, in FP9 SWF spec allows you to store images (as subclasses of BitmapData) larger than 2880×2800 using DefineBitsJPEG3/DefineBitsLossless2. You can even instantiate them and copy pixels from them. You can try this yourself in the Flash IDE! Just save a huge PNG and load it in to Flash and then try to copy pixels from a rect like (3000,3000,100,100).
I wonder what the limitations there are of this method. Does it break parts of the Flash API? How big of an image can you load?
Regardless, I hope this “feature” stays in FP10!
One new feature I would love in FP10 is to be able to disable alpha premultiplying! This would greatly improve performance of “data” bitmapdata’s (you know, bitmap data’s that will never directly be assigned to a Bitmap.bitmapData, but are just used to copyPixels from) and also allow for a simple way to perform image operations with alpha without losing so much information!
28 August 2008 @ 2:00 am
This is one great news about FP10. I did not know about it before.
30 August 2008 @ 9:54 am
Great news? Sorry to be a pessimist, but someone show me a banner that’s 2000×8000 pixels…. No seriously, show me, it’ll be funny.
30 August 2008 @ 10:08 am
Well, I’m hoping nobody uses large bitmaps for banners.
What it is great for is doing ActionScript based art, drawing it to a bitmap and saving it. Particularly if you want to print it, you need high resolution.
1 September 2008 @ 12:31 pm
Well I want to use large bitmaps for zoomed panorama shots – very wide compared to height. Any way around the 8191px-in-one-direction limit?
1 September 2008 @ 12:43 pm
Harry, well, in Flash 9, there is a workaround where if you load in a large bitmap or embed it, You can then use its bitmapdata even though it’s larger than 2880×2880. The limit is only enforced in the constructor. You could try doing this in Flash 10 – load a 10,000 x 800 bitmap for example, and see if it works.
22 October 2008 @ 12:33 am
Thanks for a good info and example, but is it possible for flash 10 to load local image that has bigger data than 16,769,025 pixels?
3 November 2008 @ 9:25 am
and this is not possible with CS3?
i need a bitmapdata af 3416 x 43 px!
and this needs to run on an air application…
anyone knows about this?
14 November 2008 @ 9:11 am
Well I tried building a bitmap in CS4 that’s 3396 x 2384 and it still gives me an error.
“ArgumentError: Error #2015: Ongeldige BitmapData.”, meaning “Invalid BitmapData”.
Lowering the 3396 to 2880 makes the application work fine. Any ideas?
14 November 2008 @ 9:13 am
Also, the manual says
“The maximum width and maximum height of a BitmapData object is 2880 pixels.”
See: http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/BitmapData.html
Sorry for double post
14 November 2008 @ 10:03 am
ar34z, 2880 is the limit in Flash CS3 / Flash 9. You must be publishing for Flash 9 player. The docs are wrong.
14 November 2008 @ 10:32 am
Ohyea, that’s it! Thanks for this quick reply, saved me a lot some lines, trouble and tihnking o/
16 November 2008 @ 3:51 pm
Hi Keith,
I was having a play around with this, and although you can create a Bitmapdata with the dimensions, say, 7735 by 2169, drawing to it seems to impose a limit of roughly 4096 in either direction (coincidently, or perhaps not coincidently, the maximum size for a square BitmapData you mentioned).
This seems to apply also when drawing using a Matrix, not just with a massive source DisplayObject. For example:
var bigBMD:BitmapData = new BitmapData( 7735, 2169 );
var circle:Shape = new Shape();
circle.graphics.lineStyle( 1, 0x000000 );
circle.graphics.beginFill( 0xB90066 );
circle.graphics.drawCircle( 38.6, 10.8, 38 );
circle.graphics.endFill();
bigBMD.draw( circle, new Matrix( 100, 0, 0, 100 ) );
var bytes:ByteArray = PNGEncoder.encode( bigBMD );
var stream:FileStream = new FileStream();
stream.open( File.desktopDirectory.resolvePath( 'uh-oh.png' ), FileMode.WRITE );
stream.writeBytes( bytes, 0, bytes.bytesAvailable );
stream.close();
Perhaps this has something to do with Flash’s ability to render vector data above a certain size, because if you draw the source to a small BitmapData first, then draw this BitmapData to the large one with a scaled Matrix, it works. Of course, this somewhat defeats the point, as the result is a pixelated image.
Just wondering whether you knew about this limitation and whether it was indeed a by-product of some boundary to the dimensions of a vector object (or the rendering of it). I couldn’t find anything mentioning this restriction; though it seems the only reasonable conclusion. Of course, breaking up the draw procedure into chunks < 4096 isn’t much of a problem, but it’s made me curious as to the cause none-the-less! Thought I should run it by your larger and more informed brain
17 November 2008 @ 1:01 am
[...] Player 9, I believe they upped the cacheAsBitmap limit from 2880×2880 pixels to over 9000 or something. Â So, maybe it is in fact succeeding and thus this is what’s screwing up my [...]
5 December 2008 @ 5:33 pm
[...] like scrolling and transformations. One drawback from the switch is being limited to the 2,880 (double in F10) pixel size [...]
6 January 2009 @ 10:55 am
[...] Big Ass Bitmaps in Flash 10 | BIT-101 Blog. [...]
22 January 2009 @ 2:01 am
Keith, I am running into this issue using RAVIS, or at least I think this is what is happening. Is this limit for the stage of the Flash player, as well? If I have UIcomponents on stage that extend past 5000 pixels wide and high will limit be reached?
If so does it matter if the items are set to enabled=false, visible=false, and includeInLayout= false for Flex that is? Or is this limit for all objects on the stage even if the three props above are set to true?
TIA
22 January 2009 @ 12:17 pm
what’s RAVIS?
22 January 2009 @ 4:51 pm
RAVIS => http://birdeye.googlecode.com/svn/trunk/ravis/RaVisExamples/example-binaries/RaVisExplorer.html
16 April 2009 @ 3:49 pm
[...] So Flash 10 allows us to create bitmaps that are larger than the 2880 pixels. Up to 8192 wide or tall (though not both – there’s a maximum pixel count). I’ve covered this in depth in a previous post. [...]
10 July 2009 @ 12:12 pm
Do you know how transparency affects the maximum size of the image? It seems that my images with transparency cannot be larger than 2880 in any dimension. Images without transparency do not seem to have this problem. I have posted an example at: http://tech.groups.yahoo.com/group/flexcoders/message/145279
24 July 2009 @ 9:43 pm
Is it possible to create an image format decoder (Tiff or BMP for example) using actionscript that loads the image data in to a ByteArray instead of type Bitmapdata ? AND THAT THIS DECODER AND ByteArray supports 16k x 16k images ?
I don’t need to display the whole image at any time, but would need to create a thumbnail view of 1k x 1k or 2k x 2k as an example.
Is there a maximum size for ByteArrays ?
Any help gratefully appreciated.
6 August 2009 @ 5:22 pm
Your solution lacks one big feature which I needed for a project, namely: masks. Thanks for your article which helped me a lot to create my solution.
I solved that problem as described on my blog:
http://martijnvanbeek.net/weblog/79/flash_player_bitmap_limits_again.html
6 October 2009 @ 8:26 pm
The actual allowable dimensions are even powers of 2. i.e. 4096×4096, and 8192×2048. And even thought 0xFFFFFF = 16,777,215 the total pixel count is one more than that (0-16,777,215) for a total of 16,777,216 or 2^24.
Regards, Guy
8 October 2009 @ 10:29 pm
Guy, did you actually try to make a bitmapdata of 4096×4096? or 8192×2048? Try it and let me know the results.
10 March 2010 @ 10:35 am
[...] saved. Since Flash 10 lets you have bigger bitmaps (16,777,215 pixels total, max dimension at 8,191 src) I can create a large image that tiles all the frames I currently have saved. I can have a max of [...]
4 May 2010 @ 5:41 pm
Or have bigger bitmap than You (and Adobe?) can expect:)
Please try this link http://ximap.pl/absloader.html . You can download source files from this experiment as You want. Kindly thread here, Regards, Miro
4 May 2010 @ 6:05 pm
[...] Read more here or here [...]
5 May 2010 @ 12:48 pm
Hi Moderator:)
I see that my previous post is moderated now. Hmm, is right that i make mistake? Im from Poland hehe, that’s possible…But one more time i would inform, that ExifLoader class and whole Exif library for AS3 made by shichiseki.jp allow loading and displaying much bigger bitmaps as Adobe claims. I made little app based on this library (now ready to download and bug free(???)), for experimenting with this hidden flash feature(bug?) Link to new version for You knowledge: http://http://ximap.pl/2010/05/04/534/. Sorry for my English, but i think – this is important news and all folks should be informed about that. Regards – Miro