1

I use this function for stamp two image and get result as new image file:

Public Sub CaptureFormAndSaveFile(ByVal masterimagefile As String, ByVal fileforappend As String, ByVal masterimagefileoutput As String, ByVal Left As Long, ByVal Top As Long)
On Error Resume Next

Dim Source As WIA.ImageFile
Set Source = New WIA.ImageFile
Source.LoadFile App.Path & "\" & fileforappend
  
Dim ImgF As WIA.ImageFile
Dim ImgP As WIA.ImageProcess
Set ImgF = New WIA.ImageFile
ImgF.LoadFile App.Path & "\" & masterimagefile
Set ImgP = New WIA.ImageProcess
With ImgP
    .Filters.Add .FilterInfos!Stamp.FilterID
    .Filters(1).Properties("ImageFile") = Source
    .Filters(1).Properties("Left") = Left
    .Filters(1).Properties("Top") = Top
    .Filters(1).Properties("FrameIndex") = 0
    Set ImgF = .Apply(ImgF)
End With
ImgF.SaveFile App.Path & "\" & masterimagefileoutput

Kill App.Path & "\" & masterimagefile
Kill App.Path & "\" & fileforappend

End Sub

but now i have a picturebox1.image and a png array stream like as b(), now how can stamp that image on b() and get result as new stream?

  • i resolved my question with use a special class name "cGDIPlusCache" https://www.vbforums.com/showthread.php?898911 – www.barnameha.net Jan 22 '23 at 10:44
  • You should post that answer here to benefit this community, too. – Brian M Stafford Jan 22 '23 at 14:23
  • I have seen many people who use links and refer to links for answers, and can't anyone click on the links and follow the answer? I tried to send the link like many others and of course I did not find this option that if I ask a question and find the answer in other place,here I can mark it to show that the question has been answered!!! also I tried to post the answer in the next post and mark it as solved but it was not possible, is there no way to do this? – www.barnameha.net Jan 23 '23 at 08:12
  • An issue with links is they may stop working at some point. It's better, and easier, to have the answer right here. – Brian M Stafford Jan 23 '23 at 12:19

1 Answers1

1

I found a class named cGDIPlusCache and I used is as below to resolve my question:

Dim myc As New cGDIPlusCache
myc.AddImage "captured", .mypic2.Image ' its a picturebox
myc.DrawImage LayeredCanvas_Form(ParentForm.mylayeredformid).hDC, "captured", ParentForm.capturearea.Left, ParentForm.capturearea.Top
myc.Remove "captured"
Set myc = Nothing
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83