ASPPainter::Get Info::GetPixel.vbs
'On Error Resume Next
Dim pic
Set pic = CreateObject("ASPPainter.Pictures.1")
pic.LoadFile "C:\cat.gif"
pic.SaveToFile "C:\getpixel1.png"
w = pic.Width
h = pic.Height
pic.SetImageIndex 1
pic.SetBKColor 255,255,255,255
pic.Create w,h
for x = 1 to w-1
for y = 1 to h-1
pic.SetImageIndex 0
r = pic.GetPixelRed(x,y)
g = pic.GetPixelGreen(x,y)
b = pic.GetPixelBlue(x,y)
a = pic.GetPixelAlpha(x,y)
pic.SetImageIndex 1
if b >10 then
pic.SetColor r,g,b,a
pic.SetPixel x,y
else
pic.SetColor 255,0,0,0
pic.SetTransparentPixel x,y
end if
next
next
pic.SetLineWidth 5
pic.SetColor 255,255,255,255
pic.DrawLine 0,0,w,h
pic.SetImageIndex 1
if err <> 0 then msgbox err.description
pic.SaveToFile "C:\getpixel.png"
pic.SetFormat 3
pic.SaveToFile "C:\getpixel.gif"
pic.DestroyALL
Set pic = Nothing
 |
Picture 1. GetPixel.png |
More samples:
Get info
See also:
GetPixelRed,
GetPixelGreen,
GetPixelBlue,
GetPixelAlpha,
SetPixel,
SaveToFile,
DestroyALL,
SetFormat,
SetImageIndex,
SetLineWidth,
SetColor,
SetTransparentPixel,
LoadFile,
SetBKColor,
Create,
Width,
Height,
SaveToFile