尝试修改后保存图像 [英] trying to save image after modification

查看:77
本文介绍了尝试修改后保存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道为什么这个源代码会抛出错误?

Dim myBitmap As System.Drawing.Bitmap

Dim myGraphics As Graphics

myBitmap = New System.Drawing.Bitmap(fileName:=" C:\ test.tif")

myGraphics = PictureBox1.CreateGraphics

Dim expansionRectangle As New Rectangle (25,550,1000,350)

Dim destRectangle1 As New Rectangle(0,0,1000,350)

myGraphics.DrawImage(myBitmap,destRectangle1,expansionRectangle,

GraphicsUnit.Pixel)

PictureBox1.Image.Save(" c:\ xx.tif")

myGraphics.Dispose()

myBitmap.Dispose()

myBitmap = Nothing

myGraphics = Nothing

does anyone know why this source code throws an error??
Dim myBitmap As System.Drawing.Bitmap
Dim myGraphics As Graphics
myBitmap = New System.Drawing.Bitmap(fileName:="C:\test.tif")
myGraphics = PictureBox1.CreateGraphics
Dim expansionRectangle As New Rectangle(25, 550, 1000, 350)
Dim destRectangle1 As New Rectangle(0, 0, 1000, 350)
myGraphics.DrawImage(myBitmap, destRectangle1, expansionRectangle,
GraphicsUnit.Pixel)
PictureBox1.Image.Save("c:\xx.tif")
myGraphics.Dispose()
myBitmap.Dispose()
myBitmap = Nothing
myGraphics = Nothing

推荐答案

On Sun,2007年7月8日00:29:12 -0700,Joe< jo ***** @tlen.plwrote:
On Sun, 08 Jul 2007 00:29:12 -0700, Joe <jo*****@tlen.plwrote:

>有没有人知道为什么这个源代码会抛出错误?

Dim myBitmap As System.Drawing.Bitm ap
将myGraphics作为图形调暗
myBitmap = New System.Drawing.Bitmap(fileName:=" C:\ test.tif")
myGraphics = PictureBox1.CreateGraphics
Dim expansionRectangle As New Rectangle(25,550,1000,350)
Dim destRectangle1 As New Rectangle(0,0,1000,350)
myGraphics.DrawImage(myBitmap,destRectangle1,expansionRectangle,
GraphicsUnit .Pixel)
PictureBox1.Image.Save(" c:\ xx.tif")
myGraphics.Dispose()
myBitmap.Dispose()
myBitmap = Nothing
myGraphics = Nothing
>does anyone know why this source code throws an error??
Dim myBitmap As System.Drawing.Bitmap
Dim myGraphics As Graphics
myBitmap = New System.Drawing.Bitmap(fileName:="C:\test.tif")
myGraphics = PictureBox1.CreateGraphics
Dim expansionRectangle As New Rectangle(25, 550, 1000, 350)
Dim destRectangle1 As New Rectangle(0, 0, 1000, 350)
myGraphics.DrawImage(myBitmap, destRectangle1, expansionRectangle,
GraphicsUnit.Pixel)
PictureBox1.Image.Save("c:\xx.tif")
myGraphics.Dispose()
myBitmap.Dispose()
myBitmap = Nothing
myGraphics = Nothing



它会抛出什么错误?


-
http://bytes.thinkersroom.com


Joe写道:
Joe wrote:

有没有人知道为什么这个源代码会抛出错误?


Dim myBitmap As System.Drawing .Bitmap

Dim myGraphics As Graphics

myBitmap = New Sys tem.Drawing.Bitmap(fileName:=" C:\ test.tif")

myGraphics = PictureBox1.CreateGraphics
does anyone know why this source code throws an error??
Dim myBitmap As System.Drawing.Bitmap
Dim myGraphics As Graphics
myBitmap = New System.Drawing.Bitmap(fileName:="C:\test.tif")
myGraphics = PictureBox1.CreateGraphics



那个没有为图片框中的图像获取图形对象,它会为屏幕获取图形对象。对于图片框控件没有具体的

CreateGraphics方法,你使用的是继承自Control类的

方法。

That doesn''t get a graphics object for the image in the picture box, it
gets a graphics object for the screen. There is no specific
CreateGraphics method for the picture box control, you are using the
method inherited from the Control class.


Dim expansionRectangle As New Rectangle(25,550,1000,350)

Dim destRectangle1 As New Rectangle(0,0,1000,350)

myGraphics .DrawImage(myBitmap,destRectangle1,expansionRectangle,

GraphicsUnit.Pixel)

PictureBox1.Image.Save(" c:\ x.tif")
Dim expansionRectangle As New Rectangle(25, 550, 1000, 350)
Dim destRectangle1 As New Rectangle(0, 0, 1000, 350)
myGraphics.DrawImage(myBitmap, destRectangle1, expansionRectangle,
GraphicsUnit.Pixel)
PictureBox1.Image.Save("c:\xx.tif")



你有没有把图像放在图片框中?这里没有代码。

Have you even put an image in the picture box? There is no code for it here.


myGraphics.Dispose()

myBitmap.Dispose()

myBitmap = Nothing

myGraphics = Nothing
myGraphics.Dispose()
myBitmap.Dispose()
myBitmap = Nothing
myGraphics = Nothing



-

G?ran Andersson

_____
http://www.guffa.com


7月8日上午8:13,G?跑Andersson< g ... @ guffa.comwrote:
On Jul 8, 8:13 am, G?ran Andersson <g...@guffa.comwrote:

Joe写道:
Joe wrote:

有谁知道为什么这个源代码会抛出错误?
does anyone know why this source code throws an error??


Dim myBitmap As System.Drawing.Bitmap

Dim myGraphics As Graphics

myBitmap =新的System.Drawing.Bitmap(fileName:=" C:\ test.tif")

myGraphics = PictureBox1.CreateGraphics
Dim myBitmap As System.Drawing.Bitmap
Dim myGraphics As Graphics
myBitmap = New System.Drawing.Bitmap(fileName:="C:\test.tif")
myGraphics = PictureBox1.CreateGraphics



这并没有为图片框中的图像获取图形对象,它为b / b $ b获取了屏幕的图形对象。对于图片框控件没有具体的

CreateGraphics方法,你使用的是继承自Control类的

方法。


That doesn''t get a graphics object for the image in the picture box, it
gets a graphics object for the screen. There is no specific
CreateGraphics method for the picture box control, you are using the
method inherited from the Control class.


Dim expansionRectangle As New Rectangle(25,550,1000,350)

Dim destRectangle1 As New Rectangle(0,0,1000,350)

myGraphics .DrawImage(myBitmap,destRectangle1,expansionRectangle,

GraphicsUnit.Pixel)

PictureBox1.Image.Save(" c:\ x.tif")
Dim expansionRectangle As New Rectangle(25, 550, 1000, 350)
Dim destRectangle1 As New Rectangle(0, 0, 1000, 350)
myGraphics.DrawImage(myBitmap, destRectangle1, expansionRectangle,
GraphicsUnit.Pixel)
PictureBox1.Image.Save("c:\xx.tif")



你有没有把图像放在图片框中?这里没有代码。


Have you even put an image in the picture box? There is no code for it here.


myGraphics.Dispose()

myBitmap.Dispose()

myBitmap = Nothing

myGraphics = Nothing
myGraphics.Dispose()
myBitmap.Dispose()
myBitmap = Nothing
myGraphics = Nothing



-

G?ran Andersson

_____http://www.guffa.com


--
G?ran Andersson
_____http://www.guffa.com



是的,图片显示。

好​​吧,也许我有点困惑;我只是想加载TIF文件

(无论它可能是什么对象),选择一些矩形区域并将其复制

并将其保存到单独的TIFF文件中。 />
如何做到这一点?

感谢您的帮助。

yes, the picture is displayed.
ok, maybe I am little confused; I am just trying to load TIF file
(whatever object it may be in), select some rectangle area and copy it
and save it into separate TIFF file.
how hord is it to do?
thanks for your help.


这篇关于尝试修改后保存图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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