.NET C#代碼的Delphi(X3更大)的JPEG VS .NET(X1小)的JPEG文件大小
var mimage = new MemoryStream();
my_image.Save(mimage, System.Drawing.Imaging.ImageFormat.Jpeg);
Delphi代碼
//bSource HAS THE ORIGINAL IMAGE
bSource := Tbitmap.Create;
//...
//CODES HERE...
//...
//CODES HERE...
//...
bDest := Tbitmap.Create;
bDest.SetSize(r.width , r.height);
bDest.Canvas.FillRect(bDest.Canvas.ClipRect);
//CODES HERE...
//bDest HAS THE IMAGE FROM <<<bSource>>>>
//CODES HERE..
bSource.Free;
jDest := TJpegImage.Create;
jDest.ProgressiveEncoding:=true;
jDest.CompressionQuality :=100;
jDest.Smoothing := True;
jDest.PixelFormat := jf24bit;
jDest.Compress;
jDest.Assign(bDest); //bDest COPY
jDest.SaveToFile('BIG_FILESIZE_THAN.NET.JPEGx3.jpg'); //FILE SIZE IS TIMES 3 BIGGER THAN .NET
jDest.Free;
bDest.Free;
相同圖像保存
期間比較德爾福有5k的文件大小與200x200 8bpp = BIGGER?
.Net具有2k的文件大小和200x200 24bpp = SMALLER?
在Delphi中需要做些什麼來使它像.NET的大小一樣?
在Delphi中,嘗試將CompressionQuality設置爲75,並且應該具有可比性。見http://stackoverflow.com/questions/3957477/what-quality-level-does-image-save-use-for-jpeg-files –
你沒有具體要求更大的文件大小? –