Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Displaying Very Large Images in ImageView

Is this possible? It seems that as the filesize approaches 1MB I start having troubles loading images into imageviews.

 

Here is an example of some code that will not function:

Page {
    Container {
        layout: DockLayout {}
        ImageView {
            imageSource: "asset:///Cambridge-02-Landscape-19-11-1977-United-Kingdom.jpg"
        }
    }
}

 You can find that image at:

http://blakemaybank.com/wp-content/uploads/2012/07/Cambridge-02-Landscape-19-11-1977-United-Kingdom....

if you'd like to download it and demonstrate code to display it somehow.

 

Is there any documentation on image size limits or displaying large images and the like?

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Highlighted
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Displaying Very Large Images in ImageView

It's likely not the file size, but rather the dimensions. I believe there's a (documented, but perhaps obscurely?) upper limit around 4096x4096 or maybe even 2048x2048 on image sizes. Above that you'd presumably have to slice it into pieces and manage the pieces yourself in something like a ScrollView.

As I recall, this ultimately goes back to limitations of the OpenGL hardware, but unfortunately I have no idea specifically where we'd see these things documented.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: Displaying Very Large Images in ImageView

[ Edited ]

I see. Well even knowing what the exact upper limit for dimensions are would help. That way I can at least display an error message and tell the user of my application they should try invoking the browser to view the image. Right now I just push a blank page onto the navigation stack, which is not good.

 

edit: Hmm, on second thought, can I even identify the dimensions of the photo once I download it from the web and make an Image out of it?

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Displaying Very Large Images in ImageView

I believe the upper limit is 2048x2048 and is related to a maximum supported texture size.

 

Resize the image using QImage before displaying it in ImageView, this thread has a code snippet for this:

http://supportforums.blackberry.com/t5/Cascades-Development/ImageView-cascades-noob-question/m-p/211...

Image size can be obtained using QImage. The snippet above also shows how to do this.

 

 


Andrey Fidrya, @zmeyc on twitter