【发布时间】:2011-07-11 08:43:49
【问题描述】:
异常详细信息:System.ArgumentException:参数无效。
Bitmap result = new Bitmap(7016, 9921);
部分方法:
public Bitmap ResizeBitmap(Bitmap b, int nWidth, int nHeight)
{
Bitmap result = new Bitmap(nWidth, nHeight);
nWidth 和 nHeight 抛出了同样的错误,所以我用显式值替换了它,仍然是同样的错误,虽然它似乎适用于较小的数字,但是:
http://msdn.microsoft.com/en-us/library/7we6s1x3.aspx
似乎没有表明有任何限制?我试过了:
Bitmap result = new Bitmap(nWidth, nHeight);
Bitmap result = new Bitmap(7016, 9921);
Bitmap result = new Bitmap((int)7016, (int)9921);
都以同样的方式失败。
【问题讨论】:
-
由于可用内存而发生异常。 Piotr 可能有更多的记忆。
-
检查此stackoverflow.com/questions/5801652/….. 类似于您现在拥有的
-
您知道您正在尝试分配大约 280 兆字节,对吗?尝试更小的尺寸,看看是否能找到限制。