求代码: VB自动去红章(jpg)
图片有红章,消掉红章,不要手工.如图实际上图片分辨率3184*2224 16M,有什么办法自动去盖章,非常感谢!!
Public Sub AnalysisPB() '解析PBB Pbb = PBag.Contents Dim i As Long Dim HBN As Long For i = 0 To 200 If Pbb(i) = 66 And Pbb(i + 1) = 77 Then PbT.BMPSTART = i Exit For End If Next i If PbT.BMPSTART = 0 Then MsgBox "解析图像数据失败", vbCritical, "致命错误" End End If CopyMemory PbT.DatStart, Pbb(PbT.BMPSTART + 10), 4 PbT.DatStart = PbT.DatStart + PbT.BMPSTART CopyMemory PbT.MaxX, Pbb(PbT.BMPSTART + 18), 4 CopyMemory PbT.MaxY, Pbb(PbT.BMPSTART + 22), 4 ReDim PbT.X(PbT.MaxY) HBN = PbT.MaxX * 3 If HBN Mod 4 <> 0 Then HBN = HBN + (4 - HBN Mod 4) End If For i = 1 To PbT.MaxY PbT.X(PbT.MaxY - i + 1) = PbT.DatStart + HBN * (i - 1) Next i End Sub
Public Sub 画圆(X As Long, Y As Long, R As Long, Optional Red As Byte = 0, Optional Green As Byte = 0, Optional Blue As Byte = 0) 'X,Y,R 以缇为单位 Dim i As Long, j As Long Dim m As Long, m2 As Long Dim n1 As Long, n2 As Long i = Int(X / TX) j = Int(Y / TX) m = Int(R / TX) Call 画点(i, j, Red, Green, Blue) For n1 = 0 To m m2 = Sqr(m * m - n1 * n1) For n2 = -m2 To m2 Call 画点(i + n1, j + n2, Red, Green, Blue) Call 画点(i - n1, j + n2, Red, Green, Blue) Next n2 Next n1 End Sub '画点 Public Sub 画点(X As Long, Y As Long, Optional Red As Byte = 0, Optional Green As Byte = 0, Optional Blue As Byte = 0) 'X,Y 以像素为单位 Dim m As Long If X > 0 And Y > 0 And Y < PbT.MaxY And X < PbT.MaxX Then m = PbT.X(Y) + X * 3 Pbb(m) = Blue Pbb(m + 1) = Green Pbb(m + 2) = Red End If End Sub