0

Suppose you have an image that measures 500x6000 pixels. I tried loading such an image in my Android app but soon found out that there are maximum dimensions for bitmaps (as described here)

Now, I still would like to be able to show such an image. How can I do that?

I could just simply adjust the height. But since the image has only 500px in width the resolution becomes poor really quick.

Community
  • 1
  • 1
user2426316
  • 7,131
  • 20
  • 52
  • 83

1 Answers1

0

This is exactly the reason BitmapRegionDecoder exists - it allows you to decode just a portion of a larger image at a time.

However, it does imply that you know the exact regions you wish to decode and how to tile/scroll images together as needed.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
  • Hi! I have same problem. But. I need to load very large image.jpg(750x7400) into ImageView(which wrapped by ScrollView). I need whole image to make scrolling it.. How can I achive this? Thank you in advance! – researcher Oct 13 '16 at 20:05
  • @researcher - you can try something like [this library](https://github.com/diegocarloslima/ByakuGallery) which a Google search for 'bitmapregiondecoder example' brings up :) – ianhanniballake Oct 13 '16 at 20:55
  • Thanks for response! But I have already tried this library( It's not what I want.. – researcher Oct 13 '16 at 20:59
  • @researcher - then you'll have to build something yourself on top of `BitmapRegionDecoder`. – ianhanniballake Oct 13 '16 at 20:59
  • Ok, thanks:) I'll try to do smth with BitmapRegionDecoder. – researcher Oct 13 '16 at 22:53