我用GDI+做图片处理,把图片转换成jpeg格式的时候怎么指定压缩比?于jpeg格式相关的参数有哪些?

解决方案 »

  1.   

    可以如下,(其他格式也许也可,试一下)记得加入 use jpeg.
    var
      MyJpeg: TJpegImage;
      Image1: TImage;
    begin
      Image1:= TImage.Create(self);
      MyJpeg:= TJpegImage.Create;
      Image1.Picture.Bitmap.LoadFromFile('c:\windows\desktop\aa.BMP');  // Load the Bitmap from a file
      MyJpeg.Assign(Image1.Picture.Bitmap);  // Assign the BitMap to MyJpeg object
      MyJpeg.CompressionQuality:=StrToInt('75');
      MyJpeg.Compress;
      MyJpeg.SaveToFile('c:\windows\desktop\test.JPG'); // Save the JPEG to Disk
    end;
      

  2.   

    压缩JPG图片不需要用GDI+的
    就上面这样OK