笨办法:<br>1将jpg格式转换成bmp<br> bmp := TBitmap.Create;<br> jpg := TJpegImage.Create;<br> try<br> jpg.LoadFromFile('f.jpg');<br> bmp.Assign(jpg);<br> bmp.SaveToFile('f.bmp');<br> finally<br> bmp.Free;<br> jpg.Free;<br> end;<br><br>2压缩bmp<br> b1 := TBitmap.Create;<br> b2 := TBitmap.Create;<br> try<br> b1.LoadFromFile('f.bmp');<br> b2.PixelFormat := b1.PixelFormat;<br> b2.width := round(b1.width*sqrt(所需大小/实际大小));<br> b2.height := round(b1.height*sqrt(所需大小/实际大小));<br> b2.Canvas.StretchDraw(Rect(0,0,b2.width,b2.height),b1);<br> b2.SaveToFile('f.bmp');<br> end;<br> finally<br> b1.free;<br> b2.free;<br> end;<br><br>3将bmp转换成jpg<br> bmp := TBitmap.Create;<br> jpg := TJpegImage.Create;<br> try<br> bmp.LoadFromFile('f.bmp');<br> jpg.Assign(bmp);<br> jpg.JPEGNeeded;<br> jpg.SaveToFile('f.jpg');<br> finally<br> bmp.Free;<br> jpg.Free;<br> end;<br>至于控制jpg到固定大小由于不同图象压缩比例不同,不太清楚