C#"参数无效&QUOT。创建新的位图 [英] C# "Parameter is not valid." creating new bitmap

查看:348
本文介绍了C#"参数无效&QUOT。创建新的位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我尝试创建一个位图比19000像素大我得到的错误:参数无效。
我怎样才能解决这个?

if I try to create a bitmap bigger than 19000 px I get the error: Parameter is not valid. How can I workaround this??

System.Drawing.Bitmap myimage= new System.Drawing.Bitmap(20000, 20000);

谢谢!

推荐答案

请记住,这是记忆有很多你想与位图来分配。

Keep in mind, that is a LOT of memory you are trying to allocate with that Bitmap.

请参照<一个href=\"http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/37684999-62c7-4c41-8167-745a2b486583/\">http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/37684999-62c7-4c41-8167-745a2b486583/

.NET很可能拒绝创建使用了,一个图像所占用的连续内存的一次。

.NET is likely refusing to create an image that uses up that much contiguous memory all at once.

略难读,但这个基准以及帮助:

Slightly harder to read, but this reference helps as well:

<一个href=\"http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.drawing/2005-06/msg00176.html\">http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.drawing/2005-06/msg00176.html

在系统中的每个图像有这个公式定义的内存量。

Each image in the system has the amount of memory defined by this formula..

位深*宽*高/ 8

这意味着图像的像素40800由4050将需要超过660
  兆内存。

This means that an image 40800 pixels by 4050 will require over 660 megabytes of memory.

这篇关于C#&QUOT;参数无效&QUOT。创建新的位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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