Hello I created an image of my signature on a piece of white paper and scanned it.
When I add it to a document the white background is visible.
How can I modify that to show the signature without borders or background?
Thanks.
Lennox
Hello I created an image of my signature on a piece of white paper and scanned it.
When I add it to a document the white background is visible.
How can I modify that to show the signature without borders or background?
Thanks.
Lennox
create a mask for the image based on the white (or near white) pixels in the foreground
this code scans a directory for PNG files and creates a mask for each one…
Alter as is required for your situation
Dim dlg As OpenDialog
Dim f As FolderItem
Dim p As picture
Dim g As graphics
Dim p_rgb As RGBSurface
Dim m_rgb As RGBSurface
Dim x As Integer
Dim y As Integer
dim i as integer
dim f2 as FolderItem
f2=GetFolderItem("")
for i=1 to f2.Count
f=f2.TrueItem(i)
if right(f.DisplayName,4)<>".png" then continue
p=picture.Open(f)
g=p.Graphics
p_rgb=p.RGBSurface
m_rgb=p.Mask.Rgbsurface
m_rgb.FloodFill(0,0,&c000000)
For x=0 To g.Width
For y=0 To g.Height
//if p_rgb.pixel(x,y)=&c000000 then p_rgb.pixel(x,y)=&cffffff
If p_rgb.Pixel(x,y)=&cffffff Then
m_rgb.pixel(x,y)=&cffffff
Else
m_rgb.pixel(x,y)=&c000000
End If
Next y
Next x
p.Transparent=1
p.Save(f,picture.SaveAsPNG)
next i
MsgBox "done"
Quit
Thanks Dave,
Works great as you recommended “Alter as is required for your situation”.
Thanks Again!
Lennox