Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24528] Android: Fails to load images that exceed GPU max texture size

GitHub Issuen/a
TypeBug
PriorityHigh
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 6.0.3, Release 8.0.2
Fix Version/sn/a
ComponentsAndroid
Labelscamera, engSchedule, imageView, photogallery
ReporterJoshua Quick
AssigneeJoshua Quick
Created2017-03-23T23:01:31.000+0000
Updated2020-10-26T18:07:47.000+0000

Description

*Summary:* Android will fail to load an image or throw an exception if the image size: * Exceeds the GPU's max texture size (aka: GL_MAX_TEXTURE_SIZE). * Exceeds the canvas' max bitmap size of 100 MB (uncompressed, 32-bit color). *Steps to reproduce:*

Create a 10,000x10,000 pixel PNG and name it "LargeImage.png".

Copy the image to a Titanium project's "Resources/assets/images" directory.

Run the below code on an Android device.

Observe the Android log.

var window = Titanium.UI.createWindow();
var imageView = Ti.UI.createImageView(
{
	image:"/assets/images/LargeImage.png",
	height: Ti.UI.FILL,
	width: Ti.UI.FILL,
});
window.add(imageView);
window.open();
*Result:* The image either fails to load and keeps running or it will crash with an exception. If the app doesn't crash, then you'll see the following warning message in the Android log... * "Bitmap too large to be uploaded into a texture" If it crashes, then you may see one of the following exceptions in the Android log... * OutOfMemoryException * java.lang.RuntimeException: Canvas: trying to draw too large(Xbytes) bitmap. *Recommended Solution:* Titanium should automatically downscale/down-sample the image to a size that the GPU can display onscreen. *Notes:* This issue can commonly happen on devices whose camera takes pictures larger than what the GPU can display. That is, the camera megapixel count exceeds the GPU max texture size, preventing camera shots from being displayed on the same device unless the image has been downscaled/down-sampled firs. This particular issue can be reproduced on the following devices: * Samsung Galaxy Nexus * Samsung Galaxy S4

Comments

  1. Joshua Quick 2017-04-08

    master: https://github.com/appcelerator/titanium_mobile/pull/8951
  2. Joshua Quick 2017-11-07

    Unfortunately, I don't see us working on this in the next couple of months. Other higher priority tasks are in the queue. No ETA yet.
  3. Gary Mathews 2018-03-14

    Setting to In Progress

JSON Source