1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| if FileExists(st_src) then
begin
st2 := st_dest + Copy(st1, 1, pos('.', st1)-1) + 'a.jpg';
st3 := st_dest + Copy(st1, 1, pos('.', st1)-1) + 'b.jpg';
if not FileExists(st2) and (f1(st2) = 0) then
begin
JPEG1 := TJPEGImage.Create;
BMP1 := TBitmap.Create;
try
JPEG1.LoadFromFile(st_src);
BMP1.assign(JPEG1);
BMP1.Dormant; // Libère les ressources GDI
BMP1.FreeImage; // Libère la mémoire.
JPEG1.PixelFormat := jf8Bit;
JPEG1.Grayscale := True;
JPEG1.CompressionQuality := 66;
JPEG1.Scale := jsQuarter;
JPEG1.assign(BMP1);
//JPEG1.Compress;
JPEG1.SaveToFile(st2);
except
on EInvalidGraphic do JPEG1 := nil;
end;
Application.ProcessMessages;
jpeg1.Free;
BMP1.Free;
Application.Initialize
end ;
if FileExists(st2) and not FileExists(st3) and (f1(st2) <> 0) and (f1(st3) = 0) then
begin
JPEG1 := TJPEGImage.Create;
BMP1 := TBitmap.Create;
try
JPEG1.LoadFromFile(st2);
BMP1.assign(JPEG1);
BMP1.Dormant; // Libère les ressources GDI
BMP1.FreeImage; // Libère la mémoire.
JPEG1.PixelFormat := jf8Bit;
JPEG1.Grayscale := True;
JPEG1.CompressionQuality := 66;
JPEG1.Scale := jsQuarter;
JPEG1.assign(BMP1);
//JPEG1.Compress;
JPEG1.SaveToFile(st3);
except
on EInvalidGraphic do JPEG1 := nil;
end ;
Application.ProcessMessages;
jpeg1.Free;
BMP1.Free;
end ;
end; |