2

Given a JPEG Encoded byte array taken from a camera, I need to decode it and display its image (bitmap) in my application. From searching around, I've found that there are two primary ways to go about this: use NDK Jpeg Decoding library or use BitmapFactory.decodeByteArray. This is for an experimental embedded device being developed that runs on Android with a built-in camera.

I would greatly prefer to develop the application in SDK not NDK if possible at all, but many people seemed to handle this problem by going straight to NDK, which bugged me a bit.

  • Is there some sort of inherent limitation in BitmapFactory.decodeByteArray that forces you to handle this problem by using libjpeg in NDK (Perhaps speed? Incompatibility?)

Performance isn't a big consideration unless if it takes say more than 45 seconds to decode the image and display it.

This is an important decision I need to make upfront, so I'd appreciate any thoughtful answers. Thank you so much.

4

1 回答 1

2

这是一个非常好的示例/说明如何在不使用 NDK 的情况下有效地在设备上解码图像:高效显示位图。您可以选择从流或文件中解码位图,这取决于您的需要。但是在我的大多数应用程序中,我都使用相同的方法,并且效果很好。所以我建议你看一下SDK示例。

希望它会帮助你。

于 2013-02-28T08:57:28.213 回答