如何把图片转换成16进制数据,用一个变量来获取这些数据,最好是有一个控件或函数可以把转换后的数据输出来。还有能不能从数据里或图片中把色素提取出来。
解决方案 »
- 宁波柯力D2002E RS232取数问题
- 在DataGraid中删除数据出错?
- 急救:C/S系统(VB+Sql Server),要求数据库操作组件在服务器端运行,如何实现?
- 如何打开有密码的ACCESS2000数据库。连接语句该怎样写?
- 如何获得局域网内某台机器的访问权限
- model来电显示http://expert.csdn.net/Expert/topic/1685/1685421.xml?temp=.1362726
- vb如何掉web服务?
- 如何让一个form总是显示在最前面;
- 请问:我的COMBOBOX为什么对CHANGE事件没有响应
- SQL数据库恢复碰到的问题
- 如何在程序中动态生成控件名?
- MSHFlexGrid的选择问题
Dim pic as picturebox
Function change() as long()
on error resume next
Dim i as Long
Dim ii as Long
Dim height as long
dim width as long
height=pic.image.height
width=pic.image.width
dim points(height\15,width\15) as long
For i=0 to height step 15 '以像素为单位
for ii=0 to width step 15
points(i/15,ii/15) =pic.point(i/15,ii/15)
next
next
change=points
End Function
------------------------------------------------------------------------------------
将long数据转化为rgb色素
'首先定义类型RGB
Type rgb
r As Integer
g As Integer
b As Integer
End Type
'函数
Function unrgb(ByVal Color As Long) As RGB
unrgb.R = (Color And &HFF)
unrgb.G = (Color And 62580) / 256
unrgb.B = (Color And &HFF0000) / 65535
End Function
可以考虑使用GDI提供的函数。'声明API
Private Declare Function GetBitmapBits Lib "gdi32" Alias "GetBitmapBits" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As LongDim Pic as StdPicture
Dim Size as LongDim Array1() as Byte '要装入的数组Dim back as Long '接受返回值Size=Width*Height*Bpp '图像大小=宽度×高度×颜色深度Redim Array1(0 to Size-1) as Byteback=GetBitmapBits(Pic.handle,Size,Array(0)) '获取象素数据if back=0 then Msgbox "Error!" '如果返回0则表明出错。