Sauvegarde après un Resize
Bonjour à toutes et à tous,
Voici mon petit problème, je dispose d'un TImage avec déjà un fond de couleur qui est créé par une autre fiche.
Avec cette image je dois lui appliquer un resize avant de la sauver en *.Jpg.
J'obtiens bien ma sauvegarde mais pas avec le resize.
Voici le code que j'ai testé de toutes les manières possibles !
Code:
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
| procedure TmainModiffond.bcopierClick(Sender: TObject);
var
ds : string;
BMP : Tbitmap;
begin
ds:= edirectory.text;
if not DirectoryExists(ds) then ForceDirectories(ds);
BMP := Tbitmap.create;
BMP.width := sp1.value; //TSpinedit
BMP.height := sp2.value;
BMP.pixelformat := pf24bit;
SetStretchBltMode(BMP.Canvas.Handle,HALFTONE);
BMP.Canvas.StretchDraw(Rect(0,0,sp1.value,sp2.value),BMP);
with TJPEGImage.Create do
try
CompressionQuality := 80;
ProgressiveEncoding := True;
Assign(image1.picture.bitmap);
SaveToFile(ds+'\test.jpg');
finally
Free;
BMP.Free;
end;
end; |
Merci encore de votre attention,
@+,
Cincap