Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27471] Android: Unable to load large image to image view

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionDuplicate
Resolution Date2019-12-03T23:52:53.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterRakhi Mitro
AssigneeGary Mathews
Created2019-10-15T11:19:24.000+0000
Updated2019-12-03T23:52:53.000+0000

Description

The customer has a requirement where they need to get image and display it in the image view. Few images are not displayed even though images are bind to the image view. *It is throwing warning “[WARN] : OpenGLRenderer: Bitmap too large to be uploaded into a texture (4196x3363, max=4096x4096)”.* I {panel} This issue is happening because of size 4196x3363, max=4096x4096. The log mentions the max size max=4096x4096. Is there any solution or workaround for this issue? Note : This issue is on Nexus 7(OS 6.0.1) and Samsung s4(OS 4.4) devices. It is working fine on Pixel(9.0) device. Tested with 8.0.2.GA Ti SDK and 8.2.0.GA Ti SDK. {panel} Sample Test Code:
var win = Ti.UI.createWindow({
	backgroundColor : '#fff'
});

win.add(Ti.UI.createImageView({
	image : Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'test.png'),
	width : Ti.UI.SIZE,
	height : Ti.UI.SIZE,
	borderColor : 'red'
	
}));

win.open();
*Steps to reproduce:* 1. Create a sample classic project 2. Replace the app.js with attached app.js content. 3. Place the attached test.png under “Resources” folder. 4. Run the app in Nexus 7 device. *Expected*: Image should bee rendered properly. *Actual:* Image not rendered and throwing warning in the console. *Note:* We tested it and able to reproduce with the big image as like the customer image on HTC M8 eye v6.0.1

Attachments

FileDateSize
imgsample_log.rtf2019-10-15T11:19:12.000+000033407
support_consoleLog.txt2019-10-15T11:24:55.000+000065855
test.png2019-10-15T11:18:14.000+0000230106

Comments

  1. Gary Mathews 2019-10-15

    The GPUs on devices have a limitation on texture size, this is more apparent on older devices. This is not a Titanium issue, but device specific. However, you should be able to mitigate this issue by resizing your images.
       const win = Ti.UI.createWindow({ backgroundColor : 'white' });
       
       const image = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'test.png').read();
       const scale = 4096/Math.max(image.width, image.height);
       const imageResized = image.imageAsResized(image.width * scale, image.height * scale);
       
       const imageView = Ti.UI.createImageView({
       	image: imageResized,
       	width: Ti.UI.SIZE,
       	height: Ti.UI.SIZE,
       	borderColor : 'red'
       });
       
       win.add(imageView);
       win.open();
       
  2. Joshua Quick 2019-10-15

  3. Alan Hutton 2019-12-03

JSON Source