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!
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…
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
>> Now get out there and crash some browsers!
What do you mean? 4095x4095x4 (4 = 32 bits) is only 64 megabytes… 🙂
some one rember the age of the 800×600 games in DOS?
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);
}
}
Tim, nice! I was thinking about that myself, but was a couple dork points short of actually doing it. 🙂
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.
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)
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!
This is one great news about FP10. I did not know about it before.
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. 😛
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.
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?
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.
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?
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?
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?
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
ar34z, 2880 is the limit in Flash CS3 / Flash 9. You must be publishing for Flash 9 player. The docs are wrong.
Ohyea, that’s it! Thanks for this quick reply, saved me a lot some lines, trouble and tihnking o/
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 🙂
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
what’s RAVIS?
RAVIS => http://birdeye.googlecode.com/svn/trunk/ravis/RaVisExamples/example-binaries/RaVisExplorer.html
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
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.
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
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
Guy, did you actually try to make a bitmapdata of 4096×4096? or 8192×2048? Try it and let me know the results.
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
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
I am creating a proof of concept application that allows users to create their own desktop images by dragging and dropping objects and shapes onto the stage. I’m able to export large enough jpg images (e.g 1600×900 pixels,) but my exported jpg doesn’t contain any of the pixels in my movieclip that are not on the visible stage area.
My MovieClip is 1600×900 pixels and my stage is 970×570. Is it possible to export the 1600×900 jpg but have it include the pixels that are not visible on stage when exporting the file?
Hey there…
i am loading a 6144 x 4608 Px Jpg, without running into problems. I can access all of the bitmapData loaded. doing the same thing with a png of the exact same size doesnt load anything.
so the maximum number in flat images without alpha channel seam to be larger…