Witajcie forumowicze. Zwracam się z prośbą o pomoc z pytaniem jak w temacie.
Biblioteka dostępna https://github.com/exilon/QuickImageFX
Kod testowy:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Quick.ImageFX, Quick.ImageFX.GR32, Quick.ImageFX.GDI,
Quick.ImageFX.Types, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var ImageFX : IImageFX;
ms1,ms2: TMemoryStream;
begin
try
ms1:= TMemoryStream.Create;
ms2:= TMemoryStream.Create;
ms1.LoadFromFile('papagayo.jpg');
ms1.Position:=0;
ImageFX := TImageFXGR32.Create;
ImageFX.LoadFromStream(ms1);
ImageFX.Resize(400, 300, rmStretch, [rfNoMagnify], rsNearest);
ImageFX.SaveToStream(ms2, ifJPG);
ms2.Position:=0;
ms2.SaveToFile('out.jpg');
finally
ms1.Free;
ms2.Free;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ReportMemoryLeaksOnShutdown:=true;
end;
end.