views:

106

answers:

1

I am attempting to capture a very large image that was made dynamically within the Flash Player (the size of the image is 2400px by 12,000px) and am running into some very serious issues... Let me run down how the image get's to that size in the first place:

User adds elements to a canvas and then when the user is finished the canvas scales up to 2400px wide and ~12,000px tall. The problem arises when I attempt to save the image to the hard drive. Now, I dont know if this will affect the recommended fix, but the rendered image wont be saved on the hard drive, it will be sent to a server. I know about the ~4050px limit in Flash Player and was thinking I could get around that by clipping the images with the ImageSnapshot.captureBitmapData() method and keeping the required Rectangle variable below 4000px then repeat that down the large image until it reaches the end where the final images will be pieced together at a later time. However... As i mentioned the error comes when it reaches the 'fileReference.save(pngImage);' method... Has anyone else done something like this?

+1  A: 

Have you tried if fileReference.save works at all (e.g. with smaller images like 100 px height)? It seems that the image data will perhaps be transformed to string data, so there might be other limits you're not aware of at the moment (your uncompressed image data will be around 86 MB, so even a PNG file with good compression might be around 10 MB in size, at the moment you're trying to save a third of this, but 3 MB still is quite large).

schnaader
Yeah I had the save working before I tried saving such a large image.
Adrian
So then try to increase the size of the image slowly to see where the limit is and then use f.e. the half of this limit to be on the safe side.
schnaader
That's a good point though, I'll try saving a 4000 by 2400px img without the clipping and see if that works.
Adrian
Good call! I found that the issue was that I was using the callLater() function and you can't save without user input... I should really read the error a bit closer. Thanks for pointing out my stupidity! I did notice however that it was putting it out at 2880 rather than the 4095 that's allowed in FP10... any ideas?
Adrian