Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to convert bmp to jpeg

Status
Not open for further replies.

BobbaFet

Programmer
Feb 25, 2001
903
NL
procedure TForm1.Button2Click(Sender: TObject);
var
i: integer;
BMP: TBitmap;
JPEG: TJpegImage;
begin
BMP := TBitmap.Create;
JPEG := TJpegImage.Create;
try
for i := 0 to 98 do
begin
if FileExists(GRPath + '\screenshot' + IntToStr(i) + '.bmp') then
begin
BMP.LoadFromFile(GRPath + '\screenshot' + IntToStr(i) + '.bmp');
JPEG.Assign(BMP);
BMP.Assign(JPEG);
JPEG.CompressionQuality := JPEGComprRat.Value;
JPEG.Compress;
JPEG.SaveToFile(SaveToPath.Text + '\screenshot' + IntToStr(i) + '.jpg');
end;
end;
finally
BMP.Free;
JPEG.Free;
end;
end;

This is my code for converting BMP images to jpeg images.
Although it looks like there is nothing wrong with the code to me I only get to see about the bottom third of the image once converted, the rest of it is black. I dont understand why that happens, can someone explain it to me?

[bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
ow i forgot to mention that the GRPath variable is a global variable.

[bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
never mind ppl i figured out what it is, the delphi TBitmap isnt compatible with the bitmap that the game saves these screenshots in.

[bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top