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?
BobbaFet ![[bobafett] [bobafett] [bobafett]](/data/assets/smilies/bobafett.gif)
Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
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] [bobafett] [bobafett]](/data/assets/smilies/bobafett.gif)
![[bobafett] [bobafett] [bobafett]](/data/assets/smilies/bobafett.gif)
Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com