Hi Ivan,
Dim doc As Aspose.Words.Document = New Aspose.Words.Document("D:/TEMP/FSWS.docx")
'To Combine all images into single object
Dim images As New List(Of System.Drawing.Bitmap)()
Dim finalImage As System.Drawing.Bitmap = Nothing
Dim width As Integer = 0
Dim height As Integer = 0
Dim pageCounter As Integer = 0, [stop] As Integer = doc.PageCount
While pageCounter < [stop]
Dim options As New Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Jpeg)
options.PageIndex = pageCounter
'create a Bitmap from the file and add it to the list
Dim memstream As New MemoryStream
doc.Save(memstream, options)
Dim bitmap As New System.Drawing.Bitmap(memstream)
width += bitmap.Width
height = If(bitmap.Height > height, bitmap.Height, height)
images.Add(bitmap)
pageCounter += 1
End While
finalImage = New System.Drawing.Bitmap(width, height)
'get a graphics object from the image so we can draw on it
Using g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(finalImage)
'set background color
'g.Clear(System.Drawing.Color.Black)
'go through each image and draw it on the final image
Dim offset As Integer = 0
For Each image As System.Drawing.Bitmap In images
g.DrawImage(image, New System.Drawing.Rectangle(offset, 0, image.Width, image.Height))
offset += image.Width
Next
End Using
'Save it Pysical memory(optional)
finalImage.Save("C:\\stitchedImage.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
Dim pan As New Panel
pan.Location = New Point(5, 5)
pan.Size = New Size(300, 300)
pan.AutoScroll = True
Dim pic As New PictureBox
'Change the path/name of image file
pic.Image = finalImage 'Image.FromStream(memstream)
pic.SizeMode = PictureBoxSizeMode.AutoSize
pan.Controls.Add(pic)
Me.Controls.Add(pan)
In case of any ambiguity, please let me know.
hi
Hi Ivan,
'finalImage = New System.Drawing.Bitmap(width,height)
finalImage = New
System.Drawing.Bitmap(height, width)<o:p></o:p>
'g.DrawImage(image, New System.Drawing.Rectangle(offset, 0, image.Width, image.Height))
g.DrawImage(image, New System.Drawing.Rectangle(0, offset, image.Width, image.Height))<o:p></o:p>