can you help me with image resize?
say my original picture is at:
c:\dir1\viewsky.jpg
how to resize the picture proportionaly(so it won't distorted) and save it to another directory but with the same file name
c:\thumbnails\viewsky.jpg
Is this doable in visual basic? any sample code to get me started with will be much helpful.
thank you
Re: can you help me with image resize?
Without any third party's tool you won't have much choices ...
Here a quick sample or resizing ordinary picturebox - it will work ok to a certain extent.
Another way is to use Image control with Stretch = True.
Code:
Public Sub ZoomPicture(pct As PictureBox, zoom As Double)
With pct
.AutoRedraw = True
.Width = .Width * zoom
.Height = .Height * zoom
.PaintPicture .Picture, 0, 0, .ScaleWidth, .ScaleHeight
.Refresh
End With
End Sub
To save it back to JPG you won't be able from VB - BMP is the only type supported.
There is Funciton SavePicture().
Re: can you help me with image resize?
It's impossible to stretch a raster (bitmap) image without it being distorted a little, or a lot in some cases...
If you want to create images that won't be distorted when resized, you would have to use vector images. VB doesn't directly support vector graphics so you would have to write the code for that yourself.