Hey, I was wondering if anyone out there could show
me a way to resize a .jpg picture and then save it as
a .jpg again. To make thumbnails and such. Any help
would be greatly appreciated.
-Zen
Printable View
Hey, I was wondering if anyone out there could show
me a way to resize a .jpg picture and then save it as
a .jpg again. To make thumbnails and such. Any help
would be greatly appreciated.
-Zen
You can easily resize the picture using the PaintPicture method. Just pass the selected values for the Width and Height parameters. As for saving a picture to JPG, use this code from vbAccelerator (click on the "Media" category).
I'm not really sure how to use paintpicture, do you think
you could help me out with that too? Thanks a lot :)
-Zen
Ok... put a PictureBox control on the form and load a picture in it. Leave the names as they are.
When you click a form with the left mouse button, the picture will be displayed like a thumbnail and when you click with the right mouse button, it will be displayed in full-size.Code:Private Sub Form_Load()
Picture1.Visible = False
' Set the desired width and height
Picture1.Width = 1440
Picture1.Height = 780
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (Button And vbLeftButton) = vbLeftButton Then
Me.Cls
Me.PaintPicture Picture1.Picture, X, Y, Picture1.Width, Picture1.Height
ElseIf (Button And vbRightButton) = vbRightButton Then
Me.Cls
Me.PaintPicture Picture1.Picture, X, Y
End If
End Sub
Ok, I tried that and it worked well. But now how do I
save this? I see what happens is that it just resizes the
picturebox and doesn't resize the picture IN the
picturebox. It makes a new image that has nothing to
do with the picturebox, right? Now if I wanted to save
this what would I have to do (using the vbAccelerator
code you showed me). If it had been resized inside the
picturebox I could just saved the result from it, but now
I don't really know what to do.
I'm sorry if I'm asking to many questions, but I am kinda
newbie here so :) Thanks for the help so far though!
-Zen