在delphi中,如何通过编程实现把bmp位图文件转化为jpg文件,不使用dialog控件,
希望大家多指教

解决方案 »

  1.   

    http://delphi.ktop.com.tw/topic.asp?TOPIC_ID=32810
    BMP與JPG圖檔的互轉函式 【編輯】領航天使  
     【作者】領航天使
    【內文】提供兩個函式Bmp2JPG與JPG2BMP.function Bmp2JPG(BmpFileName,JPGFileName:string;CompressRate:integer=86):boolean;
    將BMP圖檔轉為JPG圖檔,BMP檔名為BmpFileName,JPG檔名為JPGFileName,CompressRate為JPG圖檔的壓縮率,若不傳入此參數內定為86%壓縮率.function JPG2BMP(JPGFileName,BmpFileName:string):boolean;
    將JPG圖檔轉為BMP圖檔,JPG檔名為JPGFileName,BMP檔名為BmpFileNamefunction Bmp2JPG(BmpFileName,JPGFileName:string;CompressRate:integer=86):boolean;
    var jpg:TJPEGImage;
        bmp:tBitMap;
    begin
      jpg:=TJPEGImage.create;
      bmp:=TBitMap.create;
      result:=true;
      try
        bmp.LoadFromFile(BmpFileName);
        jpg.assign(bmp);
        jpg.CompressionQuality:=CompressRate;
        jpg.SaveToFile(JPGFileName);
      except
        result:=false;
      end;
      jpg.free;
      bmp.free;
    end;
    function JPG2BMP(JPGFileName,BmpFileName:string):boolean;
    var jpg:TJPEGImage;
        bmp:tBitMap;
    begin
      jpg:=TJPEGImage.create;
      bmp:=TBitMap.create;
      result:=true;
      try
        jpg.loadfromfile(JPGFileName);
        bmp.assign(jpg);
        bmp.SaveToFile(BmpFileName);
      except
        result:=false;
      end;
      jpg.free;
      bmp.free;
    end;
      

  2.   

    搞定,语法写错了,应该是:
    dw_2.modify('datawindow.crosstab.staticmode=yes')