6 Replies Latest reply on Mar 13, 2013 7:13 AM by Kamelito-78

    Loading LARGE Bitmaps in Flex

    BritBoyInUSA

      I am an absolute Newbie to Flex. However, it seems an almost perfect platform for some projects that I would like to build. From my initial experimentation it seems to satisfy 99% of my needs, with may be one exception.

       

      I need to upload a local image file, which may be up to 8000 x 8000 pixels.

       

      I have seen postings regarding ActionScript workarounds for Flash 9 which had a limit of 2880 x 2880.

       

      =======================================================================

      // 1. Create an image loader and
      var DummyImageLoader:Loader = new Loader;

      // 2. Assign a function to “kidnap” the BitmapData object
      DummyImageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, DummyImageOnComplete);

      // 3. Load the image with the preferred dimension
      var DummyImageRequest:URLRequest = new URLRequest(“dummy_image.jpg);
      DummyImageLoader.load(DummyImageRequest);

      function DummyImageOnComplete(evt:Event):void {
           var DummyImageBitmap = Bitmap(DummyImageLoader.content);
           // “kidnap” the BitmapData object
          var ValidBitmapData:BitmapData = DummyImageBitmap.bitmapData;

          // you can now use ValidBitmapData to draw any element larger than 2880×2880
      }

      var InvalidBitmapData:BitmapData = new BitmapData(8000, 8000);

      ======================================================================

       

      I'm using Flex 3, SDK 3.3, and Flash 10.0.22, but have NOT been able to adapt this code to something that allows 8000 x 8000 pixel images to be loaded.

       

      FYI : I never need to display the entire image, only compressed (Thumbnail) versions.

       

      Please can someone post the exact code that does allow 'oversized' images to be loaded ? If this can be provided as a mxml file, then copious amounts of beer/liquor would be made available to the supplier, when they visit Florida

       

      Any help appreciated, Thanks, Steve.

        • 1. Re: Loading LARGE Bitmaps in Flex
          Flex harUI Adobe Employee

          The limit in FP10 is more like 4Kx4K, but isn't 8Kx8K.  That's a lot of data, more than you can see on the screen at one time.  That's a huge amount of memory, not to mention server bandwidth.  Adobe has products/services like Scene7 that can help you tune images for display.

           

          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          • 2. Re: Loading LARGE Bitmaps in Flex
            BritBoyInUSA Level 1

            Thanks for the reply.

             

            I am aware that FP10 limit is slightly over 4000x4000. That's why I'm looking for a workaround.

             

            Here is a workaround that was created for FP9's limit of 2880x2880; http://www.thedesilva.com/2008/08/workaround-flash-bitmap-maximum-width-and-height/

             

            What I would like is for someone, if possible, to re-work this code for Flex3, SDK 3.3, FP10 so that I can use Bitmaps of 8000x8000.

             

            The bandwidth is NOT an issue as these images will be loaded locally and only compressed views will be created by Flash, with them never being sent anywhere (Client side only).

             

            If anyone can help with this issue, I'd greatly appreciate it.

             

            Thanks, Steve.

            • 3. Re: Loading LARGE Bitmaps in Flex
              JaumeMussons Level 1

              Hi!

               

              I'm looking for something similar, my idea is to do the following:

               

               

              1 . load an image from disk with filereference, knowing that it can be very huge.

               

              2. create the maximum bitmapdata possible to hold the image respecting it's aspect ratio

               

              3. Reduce the size of the image to fit inside this bitmapdata

               

              4. Dispose the loaded image from memory, having only the resulting bitmapdata.

               

              So if i can do this, i will be able to work with the bitmapdata and apply all the desired transformations.

               

              Since now, i have not solved this problem.

               

              Have you found anything on this matter???

               

               

              Thanks

              • 4. Re: Loading LARGE Bitmaps in Flex
                BritBoyInUSA Level 1

                I have a solution that will be available later in November.

                 

                It will support reading image files up to 16k x 16k ! in to a Byte Array (Already Tested) and you can then do whatever you want with the data to put it in to a type 'BitmapData' which has a size limit of just over 4k x 4k.

                 

                The only restriction is that it will only support Tiff format files.

                 

                If you would like me to notify you once it is available, let me know.

                • 5. Re: Loading LARGE Bitmaps in Flex
                  Bertrand G.

                  What about OpenZoom??

                   

                  I came across this site http://openzoom.org/ which is a flex/Action script version of the deepZoom from microsoft...

                  What this basically does is handle multi-resolution images to optimize the loading by cutting the image in small pieces and displaying them on-demand in a tile.

                   

                  There is a SDK, but I don't know if it is maintained anymore...

                   

                  I've managed to do some tests using an image created with deepZoom under windows, and it works quite well. Check out this site for a cool demo:

                  http://gigapixelphotography.com/

                   

                  Cheers

                  • 6. Re: Loading LARGE Bitmaps in Flex
                    Kamelito-78

                    What about your solution ? Could you give us a link to a demo/source code ?