Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi sir,

i am using windows application in that application i saved picturebox images into one folder.

its working fine. but my aim is before saving that image i crop the image like height is 200 and width is 150.

and images are saved to take these dimensions.

please give a sample solution sir.

Thanks
Posted

1 solution

You could use something like this to resize it:

VB
Dim bm_source As New Bitmap(picturebox.Image)
Dim bm_dest As New Bitmap(150, 200)
Dim gr_dest As Graphics = Graphics.FromImage(bm_dest)
gr_dest.DrawImage(bm_source, 0, 0, bm_dest.Width + 1, bm_dest.Height + 1)
picturebox.Image = bm_dest


You could also save the bitmap immediately to file of course without assigning it back to the picturebox.

Good luck!
 
Share this answer
 
v2
Comments
Dalek Dave 11-Oct-10 7:28am    
Good Answer and Fair Comment.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900