2个回答
展开全部
比如将每个像素的RGB值乘以0.5
Private Sub Command1_Click()
For i = 0 To Picture1.Width / 15 - 1
For j = 0 To Picture1.Height / 15 - 1
R = (Picture1.Point(x, y) And &HFF) Mod 256
G = ((Picture1.Point(x, y) And &HFF00) \ &H100) Mod 256
B = ((Picture1.Point(x, y) And &HFF0000) \ &H10000) Mod 256
Picture1.PSet (x, y), RGB(R * 0.5, G * 0.5, B * 0.5)
Next j
xext i
End Sub
Private Sub Command1_Click()
For i = 0 To Picture1.Width / 15 - 1
For j = 0 To Picture1.Height / 15 - 1
R = (Picture1.Point(x, y) And &HFF) Mod 256
G = ((Picture1.Point(x, y) And &HFF00) \ &H100) Mod 256
B = ((Picture1.Point(x, y) And &HFF0000) \ &H10000) Mod 256
Picture1.PSet (x, y), RGB(R * 0.5, G * 0.5, B * 0.5)
Next j
xext i
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
窗体上放上二个PIcturebox
Private Sub Form_Load()
Set Picture1.Picture = LoadPicture("请写入你的图片路径")
Picture1.AutoRedraw = True
Picture1.AutoSize = 1
Picture1.BorderStyle = 0
Picture1.Visible = False
Me.ScaleMode = 3
Picture1.ScaleMode = 3
Picture2.AutoRedraw = True
Picture2.ScaleMode = 3
Picture2.Width = Picture1.ScaleWidth
Picture2.Height = Picture1.ScaleWidth
For i = 0 To Picture1.ScaleWidth
For j = 0 To Picture1.ScaleHeight
Picture2.PSet (i, j), Picture1.Point(i, j) '这个就是VB自带的修改像素值过程可以说巨慢无比
Next
Next
End Sub
个人建义还是用API,GDI的GetDIBits放法+模拟指针,或是GDI+的GdipBitmapLockBits
那样的话代码可能会很多,个人不建义用SetPixelV那个真心也慢。。。
Private Sub Form_Load()
Set Picture1.Picture = LoadPicture("请写入你的图片路径")
Picture1.AutoRedraw = True
Picture1.AutoSize = 1
Picture1.BorderStyle = 0
Picture1.Visible = False
Me.ScaleMode = 3
Picture1.ScaleMode = 3
Picture2.AutoRedraw = True
Picture2.ScaleMode = 3
Picture2.Width = Picture1.ScaleWidth
Picture2.Height = Picture1.ScaleWidth
For i = 0 To Picture1.ScaleWidth
For j = 0 To Picture1.ScaleHeight
Picture2.PSet (i, j), Picture1.Point(i, j) '这个就是VB自带的修改像素值过程可以说巨慢无比
Next
Next
End Sub
个人建义还是用API,GDI的GetDIBits放法+模拟指针,或是GDI+的GdipBitmapLockBits
那样的话代码可能会很多,个人不建义用SetPixelV那个真心也慢。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询