Question

When I try to load a photo from the Camera Roll. I get the following message:

Error #3683: Texture too big (max is 2048x2048).

The following code is what I'm using with Feathers/Starling:

var Image_Loader:ImageLoader = new ImageLoader();
Image_Loader.source = url;
addChild(Image_Loader);

I've been reading that I need to convert the photo into a bitmap and then resize it. This is were I need help. I don't know anything about bitmap or bitmapdata in order to make this work. Can anyone point me into the right direction or suggest some good tutorial/links for this.

Was it helpful?

Solution

I found a post and figured out what I was trying to accomplish. Load an image/photo that is to big for the current size screen I'm working with and scale it down to not get an error. Instead of using the ImageLoader. Just add the texture directly to the stage, but resize it first.

        var URLReq:URLRequest = new URLRequest("Image URL");
        var imageLoader:Loader = new Loader();

        imageLoader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, loadBit);

        imageLoader.load(URLReq);
        var myBitmap:Bitmap = new Bitmap();

        function loadBit(event:flash.events.Event):void
        {
            myBitmap = Bitmap(imageLoader.content);

            var texture:Texture = Texture.fromBitmap(myBitmap);
            var image:Image = new Image(texture);
            image.width = image.height = 300;
            addChild(image);}

OTHER TIPS

Your problem seems to be that the size of the bitmap you try to load is simply too large.

When flash loads the file it limits what it writes inside the bitmapDataObject to 2048x2048 pixels in any shape. That means a total of 4194304 pixels. Your x/y dimensions don't really matter. You have to make sure your image is less than that before import (look at your image file with windows explorer or preview on OSX, it will tell you the pixel dimesions) Multiply the two numbers and see if you get a number above or below 4194304. If it is above, and it probably is from your error, you must manually edit it with a tool like preview, photoshop, paint etc to have dimensions that give you a value equal or less than 4194304.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top