首页 Vba画像素图

Vba画像素图

举报
开通vip

Vba画像素图Vba画像素图 Sub Main() Const strBmpFile As String = "C:\1.bmp" Dim arrByte() As Byte Dim PixelCol As Long, PixelRow As Long Dim CellCol As Long, CellRow As Long Dim i As Long, j As Long Dim lngPos As Long, Zeroize As Long '获取bmp图片二进制数组 Open strBmpFile Fo...

Vba画像素图
Vba画像素图 Sub Main() Const strBmpFile As String = "C:\1.bmp" Dim arrByte() As Byte Dim PixelCol As Long, PixelRow As Long Dim CellCol As Long, CellRow As Long Dim i As Long, j As Long Dim lngPos As Long, Zeroize As Long '获取bmp图片二进制数组 Open strBmpFile For Binary As #1 ReDim arrByte(LOF(1) - 1) Get #1, , arrByte Close #1 '获取图片的像素高和宽。宽度不是4的倍数时需补零 For i = 0 To 3 PixelCol = PixelCol + arrByte(i + 18) * 256 ^ i Next For i = 0 To 3 PixelRow = PixelRow + arrByte(i + 22) * 256 ^ i Next If PixelCol Mod 4 <> 0 Then Zeroize = PixelCol Mod 4 Cells.Clear For i = PixelRow To 1 Step -1 CellRow = CellRow + 1 CellCol = 0 For j = 1 To PixelCol * 3 Step 3 CellCol = CellCol + 1 lngPos = 53 + j + (i - 1) * (PixelCol * 3 + Zeroize) Cells(CellRow, CellCol).Interior.Color = RGB(arrByte(lngPos + 2), arrByte(lngPos + 1), arrByte(lngPos)) Next Next End Sub
本文档为【Vba画像素图】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_353097
暂无简介~
格式:doc
大小:13KB
软件:Word
页数:0
分类:房地产
上传时间:2019-04-05
浏览量:31