If you want to show a large image on Android as it is...

Asked 2 years ago, Updated 2 years ago, 83 views

It's exactly what the title is. Should I use ndk to load and show the original image without OOM (Out of Memory) in the Android application?

Can I do it using opencv?

Does the default gallery on the device show the original?

If possible using opencv, please give me an example code or a web page that can be helpful.

ndk image android

2022-09-22 20:54

1 Answers

Showing a large image as a source is often meaningless. In particular, it is difficult to avoid the OOM phenomenon you mentioned, so we cannot secure the stability and performance of the app.

For example, if the ImageView is 200x200 pixels in size and the image you want to show here is 1000x1000 pixels, then showing the original doesn't offer any special benefit. It only consumes a lot of memory and increases the overhead.

Similarly, the default gallery on the device does not show the original as it is. You need to write code by subsampling a large bitmap and displaying images in smaller memory.

Please read the following document for further information.

For your information, it has nothing to do with the opencv library. Rather, I think it would be helpful to look at libraries such as Glide, Picasso, and Fresco.


2022-09-22 20:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.