Correct, Corona for Android now automatically downscales images that are larger than 1024 pixels wide or high. We did this to work-around Android JVM memory limitations and max OpenGL texture size limitations. This is especially true of older Android devices that have a JVM 16 MB max memory limit per app. For example, loading a 2048x2048 image typically fails to load because it exceeds the 16 MB limit.
What we actually do is “down sample” the image as it is loaded, meaning that we read every other pixel while loading/decoding the image file. We have to do this when loading images from the Photo Library, Camera, or large images downloaded from the Internet… all of which we were never able to do on Android before without crashing the app.
That said, I agree that our image loader in Corona can still use some tuning. Particularly, if the image is too large to load, we should down sample it but also display a polygon size matching the size of the original image file. It should also be a bit smarter and not simply down sample based on a single dimension exceeding 1024 pixels.
For now, you can work-around this issue by setting the display object’s width and height to what you expect. This will stretch the image, but of course this also means that your image has lost quality due to the down sampling.
Another bit of advise, OpenGL requires images to have dimensions that are a power of 2. For example: 256, 512, 1024, etc. In Corona, if your image is not a power of 2, then we automatically increase the width or height to a power of 2 in order to meet OpenGL’s requirements. Now here is the problem. Your image is 1280 wide, which means Corona has to bump it up to 2048 pixels wide full of empty space. On top of that, we have to load the image as a raw uncrompressed bitmap. What this means is that your 1280x800 image wastes huge amounts of memory because it has to be loaded as a 2048x1024 32-bit per pixel bitmap, which calculates to 8,388,608 bytes… or just over 8 MB for 1 image! This is extremely wasteful and I highly recommend that you resize your large images to avoid this issue. Some people get around this by using 3rd party texture packers, which packs as many images as possible within a 1024x1024 image.
Anyways, that’s my 2 cents. Bottom line, the image loader in Corona does need some tuning, but you should also consider what I’ve said in the above paragraph. You can continue to build off of an older daily build, but I recommend that you try testing your app on an older device such as the original Droid to make sure it doesn’t crash due to memory limitations.
[import]uid: 32256 topic_id: 16128 reply_id: 59979[/import]