Sub SavePicture (SourceDir As String, PicFilename As String, SaveDir As String)
' Copy the whole image to final dir
File.Copy(SourceDir, PicFilename, SaveDir, PicFilename)
' Make a thumbnail and save it to the \thumbs dir
Dim img As Image
Dim cvs As Canvas
cvs.Initialize("")
img.Initialize(SourceDir, PicFilename)
cvs.Height = img.Height
cvs.Width = img.Width
cvs.DrawImage(img, 0, 0, 200dip, 200dip)
Dim out As OutputStream = File.OpenOutput(SaveDir & "\thumbs", PicFilename, True)
cvs.snapshot.WriteToStream(out) ' Outputs as a PNG
out.Close
End Sub