|
-
January 26th, 2003, 09:55 AM
#1
Resizing Bitmaps
I'm making my first steps in vb.net and I'm trying to resize a bitmap.
I want to make an app that processes a folder with images to a new folder of images of the same size with a thumbnail version for web publication.
Opening an image and changing the size of the image in a form is easy (making use of the picturebox) but how can I save the resized image?
Thanks,
Leon
-
January 27th, 2003, 02:03 AM
#2
Try the pb.Image.Save method.
/Leyan
-
January 27th, 2003, 02:23 PM
#3
OK so I did but the saved image from picturebox.image.save has the original size and not the "screen size". . .
Greetz,
Leon
-
January 27th, 2003, 05:27 PM
#4
To resize a picture you don't need a picturebox.
Try the follow code example:
Dim Scale As Double
Dim NewWidth As Integer
Dim p1 As New System.Drawing.Bitmap("picture.jpg")
Scale = p1.Height / p1.Width
NewWidth = 200
Dim p2 As New System.Drawing.Bitmap(p1, NewWidth, CType(NewWidth * Scale, Integer))
p2.Save("new picture.jpg")
p1.Dispose()
p2.Dispose()
-
January 28th, 2003, 02:02 PM
#5
DdH,
The code works fine.
Thanks,
Leon
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|