[SOLVED] HighRes Media Photo Not Showing on Android Device (media.show)

Hi guys,

Just to share problems faced on ‘media.show’ which has been deprecated. Hope the webpage can direct people to use the other new functions (e.g. selectPhoto) so they won’t waste time like me. In other words, do NOT use media.show anymore.

I was trying to display an image from Gallery, and show it on the screen. After that, i will do some processing (like cropping).

Problems that I encounter :

  1. high res JPG image (e.g. 3264x2448 taken by Samsung S3) cannot be displayed! If the picture is taken at lower res, it can be displayed.

  2. Decode file error always appears in logs. 

    V/Corona ( 4624): Failed to load file ‘/storage/extSdCard/DCIM/Camera/20131214_ 180901.jpg’ as a 32-bit image. Reducing the image quality to 16-bit. V/Corona ( 4624): Unable to decode file ‘/storage/extSdCard/DCIM/Camera/2013121 4_180901.jpg’

Running on Corona 2013.2109 in v1 compatibility mode.

There seems to be two things going on here.  One is the color depth and the other is the image size.   The color depth is what it’s complaining about.  Most devices can’t deal with 32bits per channel per pixel.  It’s saying you need to reduce it to 16 bits per channel per pixel.  Most JPEG’s you see on the internet are 8 bits per channel per pixel (16 million colors per pixel, in 32bit mode its like billions of colors per pixel).  Most professional photographers still work with 8 bit images.    Reduce it to at least 16 bit mode, or even go to 8 bit mode which should be perfectly fine.

The next image is that depending on the device you may hit a texture memory limit.  On some devices its 1024x1024.  Many modern devices now support 2048x2048 or even 4096x4096.  If your device is a 2048x2048 or smaller device you will need to use a lower resolution image.  

Yes, media.show is deprecated and we encourage you to use media.selectPhoto() instead (http://docs.coronalabs.com/api/library/media/selectPhoto.html)  but these issues I described are device issues and the new API call will have the same issues.

Rob

You can use this:  http://docs.coronalabs.com/api/library/system/getInfo.html#maxtexturesize

to determine what the max texture size is for your device.  Be aware that running it in the simulator brings back the max texture size of the computer you are on which isn’t the same as the device you are running on.

Dear Rob,

Thanks for the explanation. The photos are taken by the phone itself (using ‘media.show’, if at 8megapx, it cannot be displayed. But if it is lower megapx,  it can be displayed)

The usage of ‘selectPhoto’ actually solves the problems that I listed above.

Just to share, the ‘maxTexture’ on a Samsung Galaxy S2 is " maxTextureSize :     4096"

There seems to be two things going on here.  One is the color depth and the other is the image size.   The color depth is what it’s complaining about.  Most devices can’t deal with 32bits per channel per pixel.  It’s saying you need to reduce it to 16 bits per channel per pixel.  Most JPEG’s you see on the internet are 8 bits per channel per pixel (16 million colors per pixel, in 32bit mode its like billions of colors per pixel).  Most professional photographers still work with 8 bit images.    Reduce it to at least 16 bit mode, or even go to 8 bit mode which should be perfectly fine.

The next image is that depending on the device you may hit a texture memory limit.  On some devices its 1024x1024.  Many modern devices now support 2048x2048 or even 4096x4096.  If your device is a 2048x2048 or smaller device you will need to use a lower resolution image.  

Yes, media.show is deprecated and we encourage you to use media.selectPhoto() instead (http://docs.coronalabs.com/api/library/media/selectPhoto.html)  but these issues I described are device issues and the new API call will have the same issues.

Rob

You can use this:  http://docs.coronalabs.com/api/library/system/getInfo.html#maxtexturesize

to determine what the max texture size is for your device.  Be aware that running it in the simulator brings back the max texture size of the computer you are on which isn’t the same as the device you are running on.

Dear Rob,

Thanks for the explanation. The photos are taken by the phone itself (using ‘media.show’, if at 8megapx, it cannot be displayed. But if it is lower megapx,  it can be displayed)

The usage of ‘selectPhoto’ actually solves the problems that I listed above.

Just to share, the ‘maxTexture’ on a Samsung Galaxy S2 is " maxTextureSize :     4096"