Decode a part of Bitmap from file in Android

后端 未结 6 1339
广开言路
广开言路 2020-12-17 01:40

I have a file with a very large image: for example 9000x9000.

I can\'t load the Bitmap in memory because the heap size. But I only need to display a small part of th

6条回答
  •  时光取名叫无心
    2020-12-17 02:07

    I don't think you can. Not even on a PC, I fail to see how you could do that without loading the entire image: most image formats, for example PNGs, have the pixel data zipped, so you need to at least unzip the IDAT chunk before you can start doing anything else and that will basically decode the whole image.

    In your shoes I would try to have a server do it for me. Where do you get the image anyway? Not from a server? Then try to make a WS request that will give you the proper part of the image. If the image does NOT come from the server you can nevertheless send it to your server to get back only the part of the image that you want.

提交回复
热议问题