Hola al foro!
Estoy haciendo un programilla, que coge todas las imagenes de un directorio y las redimiensionas. He utilzado el siguiente código, pero la imagen pierde mucha calidad y ocupa bastante más que si lo hago con el photoshop.
Alguien sabe redimensionar el tamaño de un fichero jpg?
Gracias
SAludos
DAly
-----------------------------------------------------
procedure TForm1.redimensionar(path: string);
var
registro:TSearchRec;
i:byte;
bmp: TBitmap;
jp: TJpegImage;
begin
if (findfirst(path + '\*.jpg',(faAnyFile ),registro))=0 then
begin
if not DirectoryExists(path+'\n') then
CreateDir(path+'\n\p');
i:=1;
repeat
jpg := TJpegImage.Create;
jpg.Loadfromfile(path+'\'+registro.Name);
bmp := TBitmap.Create;
bmp.Width:=strtoint(EditAncho.Text);
bmp.Height:=(jpg.Height * strtoint(EditAncho.text)) div jpg.Width;
bmp.Canvas.StretchDraw(bmp.Canvas.Cliprect, jpg);
jpg.Assign(bmp);
jpg.SaveToFile(path+'\n\'+inttostr(i) + '.jpg');
bmp.Free;
jpg.Free;
i:=i+1;
until findnext (registro)<>0
end;
end;