strImage1Path="C:\Sunset.jpg"
strImage2Path="C:\Winter.jpg"
strMergedImagePath="C:\MergeImage.jpg"'Path where the merged image is to be stored.
Set oImage=DotNetFactory.CreateInstance("System.Drawing.Image","System.Drawing")
Set oGraph=DotNetFactory.CreateInstance("System.Drawing.Graphics","System.Drawing")
Set oPens=DotNetFactory.CreateInstance("System.Drawing.Pens","System.Drawing")
Set oImage1=oImage.FromFile(strImage1Path)
Set oImage2=oImage.FromFile(strImage2Path)
inWidth=Cint(oImage1.Width)+Cint(oImage2.Width)
If oImage1.Height >=oImage2.Height Then
inHeight=Cint(oImage1.Height )
Else
inHeight=Cint(oImage2.Height )
End If
Set oBmp=DotNetFactory.CreateInstance("System.Drawing.Bitmap","System.Drawing",inWidth,inHeight)
Set gr=oGraph.FromImage(oBmp)
gr.DrawRectangle oPens.Black,0,0,Cint(inWidth)-1,Cint(inHeight)-1
gr.DrawImage oImage1,0,0
gr.DrawImage oImage2,oImage1.Width,0
oBmp.Save(strMergedImagePath)
Set oImage=Nothing
Set oGraph=Nothing
Set oPens=Nothing
Set oImage1=Nothing
Set oImage2=Nothing
Set oBmp=Nothing
Set gr=Nothing
Showing posts with label DOT Factory for Image. Show all posts
Showing posts with label DOT Factory for Image. Show all posts
Tuesday, October 4, 2011
Merging Images Using DOT NET Factory
Subscribe to:
Posts (Atom)