0

I am working on an app where I have to download images from internet and display them inside the app, I am using Universal Image Loader so far, but recently I ran into an issue where the app would not display the images which are huge in size for example 700 x 7661, I have read several posts & answers related to it but nothing seems to be a reliable solution, it appears in an hardware accelerated app the image size is limited by the OpenGL texture size limit, answers here on Stackoverflow suggest resizing the image to smaller size. I know disabling hardware acceleration fixes it, but that is not an option because it makes the whole app jittery.

My question is how can we achieve that accurately because devices have different OpenGL texture limit, some devices support 2048 x 2048 and some support 4096 x 4096, some of them support even smaller, if we resize the image by considering the smallest size the image will appear blurred on high resolution devices, so I am sort of out of clues as how to approach this issue, I have tried Picasso, Fresco & Glide and all of them have similar issue.

A sample of the image I am trying to load is https://i.stack.imgur.com/85JXK.jpg

Regards

TilalHusain
  • 1,006
  • 5
  • 17
  • 36

2 Answers2

0

You could look up the maximum texture size by using Canvas.getMaximumBitmapWidth() and Canvas.getMaximumBitmapHeight(), and then resize them before putting them into imageViews.

Vasily Kabunov
  • 6,511
  • 13
  • 49
  • 53
Leo Starić
  • 331
  • 1
  • 4
  • 16
  • I did, I followed the answer from Romain Guy here (http://stackoverflow.com/a/7523221/595603), but it returns invalid value of 32788 – TilalHusain Jul 18 '16 at 11:34
  • This might be a long shot, but from what Ive found dividing that number by 8 returns the right value, ie that number represents the number of bytes available – Leo Starić Jul 18 '16 at 11:38
0

You can read the device resolution and resize your images as for your resolution

for getting resolution see this : How to get screen resolution

Community
  • 1
  • 1
FarshidABZ
  • 3,860
  • 4
  • 32
  • 63