| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 375 人关注过本帖
标题:VB处理图象
取消只看楼主 加入收藏
qinglanzhou
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-11-1
收藏
 问题点数:0 回复次数:1 
VB处理图象

我想获得Set p = LoadPicture("c:\1.jpg")中所有象素的R,g,b值,那位高手修改一下,谢谢:qingmlanzhou@yahoo.com.cn

Private Sub Command2_Click()
Dim p As New StdPicture
Dim Ypos As Long, Xpos As Long
'如何获得图象的尺寸

Dim Pixel As BITMAP
Dim souColor As Long, souGetcolor As String
Dim souRed As Integer, souGreen As Integer, souBlue As Integer
Dim souN As Integer
Set p = LoadPicture("c:\1.jpg")
Ypos = p.Height
Xpos = p.Width
Ypos = Me.ScaleX(Ypos, vbHimetric, vbPixels) ''图象的高度,单位像素。
Xpos = Me.ScaleY(Xpos, vbHimetric, vbPixels) '图象的宽度,单位像素
Print Ypos, Xpos

GetObject p.Handle, Len(Pixel), Pixel '获取图片的象素
For i = 0 To Ypos - 1
For j = 0 To Xpos - 1
'获得源图片各点的RGB值
souColor = GetPixel(p.Handle, j, i)
souGetcolor = Hex(souColor)
souN = 6 - Len(souGetcolor)
souGetcolor = String(souN, "0") & souGetcolor
'转化为Red,Green,Blue的值
souRed = HexDec(Right(souGetcolor, 2))
souGreen = HexDec(Mid(souGetcolor, 3, 2))
souBlue = HexDec(Left(souGetcolor, 2))
Next j
Next i
End Sub

搜索更多相关主题的帖子: 图象 
2007-11-01 21:46
qinglanzhou
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-11-1
收藏
得分:0 
增么没有高手回答
2007-11-05 14:44
快速回复:VB处理图象
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015799 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved