0

In the attempt of performing animation with large set of images, I tried with FrameAnimation but I found of outofmemory exception with large set of images, after some exploration for the solution I found one good solution here Pinhassi's solution.
This one helps me to achieve animation but not smoothly because it taking a time to load the images. Then I decided to decode bitmap before starting the animation (giving bitmap instead of resID to ImageView). Through this I got smooth animation. But it is taking a time to decode the bitmap from the resources.

Is there any better approach to do the same? Any suggestion would be appreciated.

Details of the image

Total Number of images =30;

Image Dimension =1000x 720;

Size =180kb

Devices on which I am performing

Manufacture: Motorola

Model: MZ601

Android Version: 3.0

To decode Bitmap

    Bitmap mBitmap=BitmapFactory.decodeResource(getResources(),resID);
    int bitmapSize= mBitmap.getRowBytes()*mBitmap.getHeight())

The approximate bitmapSize values is 3000000 (might be it is in bytes) converting it to kilobytes 23437.5kb

Here original png file is 180kb but after decoding it, taking nearly 2MB of data. Why?

Is I am doing anything wrong in analyzing the size of bitmap?

If yes, then how to get the size of decode bitmap?

If no, then any one explain why it is taking large space?

Note: I don’t want to scale the bitmap since it is perfect to my device screen dimension which is (1280 x 752).

Thanks

In advance for valuable suggestions and solutions.

4

1 回答 1

1

这里原始的 png 文件是 180kb,但解码后,需要将近 2MB 的数据。为什么?

假设每个像素 1 个字节,三个颜色通道 (RGB) 字节大小 = 3X(1000X720)/(1024*1024) = 2.05 MB 约。

这种处理可以通过简单的位图加载达到一个限制,这就是视频编解码器存在的原因。

于 2013-01-11T10:59:33.213 回答