If you want to save it as a JPG I think you have to read upon the JPG struct and make your own function. Not the easiest in the world, but it isn't impossible....
first it starts a loop to do all bmp files in the list (For i = 0 To File1.ListCount - 1)
then it sets the current index of the loop to the file list to be able get the filename (File1.ListIndex = i)
then it loads this picture into the picturebox (Picture1.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName))
then it creates an empty jpg, blit from the pixeturebox into it, then saves it with the selected compression.
if you also want to be able to load jpg's you have to select the filelist...goto the property "Pattern", and change it from "*.bmp;*.gif" to "*.bmp;*.gif;*.jpg"
to stretch it, you have to declare the StretchBlt API:
VB Code:
Private Declare Function StretchBlt Lib "gdi32" Alias "StretchBlt" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
then change this line:
JPG.Create Picture1.ScaleWidth, Picture1.ScaleHeight
to whatever new size you want.
then change this line:
BitBlt JPG.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture1.hdc, 0, 0, vbSrcCopy
to use StretchBlt instead
Cyborg , i got it. it works really well and cool ........
if you don't mind, i really would like to know more about all your declaration and its purposes.... especially those in the module....(as i am still stranger to all those declaration that you made)
Sastraxi, thanks to you too, actually i got it already.....
to be perfectly honest with you, im not the one who wrote the jpg compression code. maybe if you look closer into the code and read the comments, you'll understand it a bit. i have'nt read that code because im a total stranger to file handling and such things so i think i'll start with something easier first...