我原来在ACCESS数据库存放的图片是BMP,如何把它转换为JPG?

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      Bmp: TBitmap;
      Jpg: TJpegImage;
    begin
    Bmp:=TBitmap.Create;
    Bmp.PixelFormat:=XXX;
    {
    Indicates the bit format of the bitmap image, specifying how the image is displayed and how the pixels of the bitmap image are stored in memory.type TPixelFormat = (pf1bit, pf8bit, pf16bit, pf32bit, pfCustom);
    property PixelFormat: TPixelFormat;DescriptionUse PixelFormat to change a TBitmap's internal image to a particular memory format and color depth, or to find out what memory format and color depth a TBitmap is using.For example, PixelFormat can be used to set the pixel format of the bitmap image to 8-bit for video drivers that cannot display the native format of a bitmap image.Note: The PixelFormat of a JPEG image object applies to the bitmap if the JPEG image is copied to it.Changing the pixel format is most commonly used with ScanLine, because your code must decode the pixel data accessed by ScanLine. Image-editing tools usually use one pixel for all internal image operations and copy the results to the screen (in whatever format) as the last step.
    }
    Jpg:=TJpegImage.Create;
    Jpg.LoadFromFile('xxxx');
    Bmp.Assign(Jpg);//转换
    Jpg.free;
    Bmp.free;
    end;
      

  2.   

    to CDSoftwareWj(95927):
       Well Done!
      

  3.   

    JPG.Assign(BMP);
    这条语句就已经自动完成了转换。