I'd like to make a simple VB utility to resize images using vb.net. I am having trouble figuring out what vb class to use to actually manipulate the images. The Image class and the Bitmap class don't work.
Any ideas, hints, tips, tutorial links are greatly appreciated.
Here is an article with full details on how to do this.
Private Sub btnScale_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnScale.Click ' Get the scale factor. Dim scale_factor As Single = Single.Parse(txtScale.Text) ' Get the source bitmap. Dim bm_source As New Bitmap(picSource.Image) ' Make a bitmap for the result. Dim bm_dest As New Bitmap( _ CInt(bm_source.Width * scale_factor), _ CInt(bm_source.Height * scale_factor)) ' Make a Graphics object for the result Bitmap. Dim gr_dest As Graphics = Graphics.FromImage(bm_dest) ' Copy the source image into the destination bitmap. gr_dest.DrawImage(bm_source, 0, 0, _ bm_dest.Width + 1, _ bm_dest.Height + 1) ' Display the result. picDest.Image = bm_dest End Sub
One more on the similar lines.