合并两个大的位图错误:未处理ArgumentException.参数无效. [英] Merge Two Large Bitmaps Error: ArgumentException was Unhandled. Parameter is not valid.

查看:94
本文介绍了合并两个大的位图错误:未处理ArgumentException.参数无效.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dim Bitmap1 As New Bitmap("C:\Pictures\Bitmap1.bmp")
Dim Bitmap2 As New Bitmap("C:\Pictures\Bitmap2.bmp")
Dim Bitmap3 As New Bitmap(30000, 2000)

Dim g As Graphics = Graphics.FromImage(Bitmap3)
g.DrawImage(Bitmap1, New Point(0, 0))
g.DrawImage(Bitmap2, New Point(0, 1001))
Bitmap3.Save("C:\Pictures\Bitmap3.bmp")

g.Dispose()
g = Nothing



我正在尝试将两个大的位图合并到1.

两个位图的大小相同,均为30000 x1000.
我已经声明了具有相同宽度(30000)的bitmap3,并添加了另一个1000以容纳bitmap1和bitmap2的组合高度.
但是,代码在此行停止,并且我收到错误消息:

g.DrawImage(Bitmap1,New Point(0,0))

如果我使用较小的位图,我相信它会很好地工作.

有任何建议吗?



I''m trying to merge two large bitmaps into 1.

Both bitmaps are the same size 30000 x 1000.
I''ve declared bitmap3 with the same width(30000), and added another 1000 to accommodate the combined heights of bitmap1 and bitmap2.
However, the code stops at this line and I receive the error:

g.DrawImage(Bitmap1, New Point(0, 0))

If I work with smaller bitmaps I believe it will work fine.

Any suggestions?

推荐答案

鉴于您声称停止的行在代码片段中不存在,因此很难解决. br/>
但是,如果您执行了
Given that the line you claim it stops on doesn''t exist in the code fragment, it isn''t easy to work out.

But, if you did execute
g.DrawImage(Bitmap3, New Point(0, 0))

在代码中间,我不太惊讶出现了一些错误:您正在尝试在自身上绘制一个位图...

in the middle of that code, I''m not too surprised things go a little wrong: you are trying to draw a bit map on itself...


这篇关于合并两个大的位图错误:未处理ArgumentException.参数无效.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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