S
sunys
Unregistered / Unconfirmed
GUEST, unregistred user!
function Bmptojpeg(bmpfilename,jpegfilename:string):String;
var
Jpeg:TJpegimage;
Bitmap:TBitmap;
begin
result:='';
try
Jpeg:=TJpegimage.create;
Bitmap:=TBitmap.create;
Bitmap.LoadFromFile(Bmpfilename);
Jpeg.Assign(Bitmap);
if trim(jpegfilename)='' then
begin
jpegfilename:=copy(Bmpfilename,1,pos('.',Bmpfilename))+'jpg';
end;
//jpeg.PixelFormat:=jf8Bit;
jpeg.SaveToFile(jpegfilename);
result:=jpegfilename;
finally
Bitmap.Free;
Jpeg.Free;
end;
end;
现在有一副BMP图象,我想转换为JPG图象时, jpeg.SaveToFile(jpegfilename);
就会出现(scan line index out of range)的错误,我加了这句jpeg.PixelFormat:=jf8Bit;
不会出现错误,但是转换后的JPG图象的大小为0,什么也看不到。向各位高手请教了
var
Jpeg:TJpegimage;
Bitmap:TBitmap;
begin
result:='';
try
Jpeg:=TJpegimage.create;
Bitmap:=TBitmap.create;
Bitmap.LoadFromFile(Bmpfilename);
Jpeg.Assign(Bitmap);
if trim(jpegfilename)='' then
begin
jpegfilename:=copy(Bmpfilename,1,pos('.',Bmpfilename))+'jpg';
end;
//jpeg.PixelFormat:=jf8Bit;
jpeg.SaveToFile(jpegfilename);
result:=jpegfilename;
finally
Bitmap.Free;
Jpeg.Free;
end;
end;
现在有一副BMP图象,我想转换为JPG图象时, jpeg.SaveToFile(jpegfilename);
就会出现(scan line index out of range)的错误,我加了这句jpeg.PixelFormat:=jf8Bit;
不会出现错误,但是转换后的JPG图象的大小为0,什么也看不到。向各位高手请教了