Wednesday, 27 May 2015
Monday, 11 May 2015
Testing
Dim img As Bitmap = New Bitmap(PictureBox1.Image)
' The section that will be cropped
Dim imgWidth As Integer = img.Width
Dim section As Rectangle = New Rectangle(0, 40, imgWidth, 30)
' Crop the image and save it.
img = CropImage(img, section)
Function CropImage(ByVal source As Bitmap, ByVal section As Rectangle) As Bitmap
Dim bmp As New Bitmap(section.Width, section.Height)
Dim g As Graphics = Graphics.FromImage(bmp)
g.DrawImage(source, 0, 0, section, GraphicsUnit.Pixel)
Return bmp
End Function
Subscribe to:
Posts (Atom)