如何在内存中存储比平时Bitmap实例和访问速度不够快更紧凑的形象? [英] How to store image in memory more compact than usual Bitmap instance and access it fast enough?

查看:107
本文介绍了如何在内存中存储比平时Bitmap实例和访问速度不够快更紧凑的形象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个5000 * 4000像素,我上呈现形式的每一帧图像。
这种图像加载像 BMP位图= Image.FromFile(test.png); 使用了大约100 MB RAM,而文件的大小是40 - 50 MB!这样,我的PROG已经使用〜500 BM RAM。

I have images like 5000*4000 pixels that I render every frame on form. Such image loaded like Bitmap bmp = Image.FromFile("test.png"); uses around 100 mb RAM, while file size is 40 - 50 mb! That way my prog already uses ~500 bm RAM.

如何存储图像的更多的内存效率,但是能够从它削减部分不够快?我有一个巨大的形象和削减从它的部分根据视图位置呈现。我致电50 FPS渲染方法不起加载从文件中的每一帧图像,因为它太慢了。

How to store that images more RAM efficient, but be able to cut parts from it fast enough? I have one huge image and cut parts from it to render according to view position. I call render method at 50 FPS and can't afford loading images from file every frame, since it too slow.

是否有任何其他方式在内存中存储的图像?

Is there any other way to store image in memory?

推荐答案

您被卡住必有加载到内存中,如果你想显示它并操纵它的uncom pressed形象。有没有办法解决这。

You are stuck with having to have the uncompressed image loaded into memory if you wish to display it and manipulate it. There is no way round this.

唯一确定的方式,以减少这是减少图像的分辨率被显示。你可以存储在内存中,并从内存而不是从磁盘每次你需要改变它的时间uncom preSS它融为一体pressed形象。

The only sure way to reduce this is to reduce the resolution of the image being displayed. You could store the compressed image in memory and uncompress it from memory rather than from disk each time you need to change it.

说了这么多的500MB RAM的并不多,这些天,其中计算机有几个GB的可用RAM。

Having said that 500MB of RAM is not that much these days where computers have several GB of RAM available.

这篇关于如何在内存中存储比平时Bitmap实例和访问速度不够快更紧凑的形象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆