Resize Image / Bitmap Easiest Way !

Submitted on: 9/9/2016 3:13:24 AM
By: SpyTamers 
Level: Beginner
User Rating: Unrated
Compatibility: VB.NET
Views: 13189
     I use this code snippet to resize image files to desired size. Maybe it will help beginners out there.

				Public Function ResizeBitmap(ByVal bitmapToResize As Bitmap, ByVal width As Integer, ByVal height As Integer)
'make a blank bitmap the correct size
Dim NewBitmap As New Bitmap(width, height)
'make an instance of graphics that will draw on "NewBitmap"
Dim BitmpGraphics As Graphics = Graphics.FromImage(NewBitmap)
'draw the bitmap to NewBitmap 
BitmpGraphics.DrawImage(bitmapToResize, 0, 0, width, height)
Return NewBitmap
End Function

Other 3 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

11/10/2016 6:23:30 PMKevin Precht

Nice, but you left off the return type for the function.

You need to have "As Bitmap" on the function
(If this comment was disrespectful, please report it.)


Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)

To post feedback, first please login.