If you are interested in ImageMagickObject Delphi example
Posted: 2009-06-30T09:23:19-07:00
The ImageMagickObject usage example - calling ImageMagick.convert method in Delphi
1. Install ImageMagick - check "Install ImageMagickObject"
2. Run Delphi, import ImageMagickObject type library (Delphi 7 - menu: "Project"/"Import Type Library")
- this should create unit ImageMagickObject_TLB.pas
3. Optionally uncomment the example you want in "Test" procedure (resize example is default)
4. Compile project, run
5. Check the output in logo2.png (example code does not display any pictures just makes a conversion)
IMPORTANT:
To compile procedure Test() include ImageMagickObject_TLB, variants and activex units in uses section
IMPORTANT:
When you get "An application has made an attempt to load the C runtime library incorrectly" error you should upgrade:
"Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)"
http://www.microsoft.com/downloads/deta ... laylang=en
Tested on:
ImageMagick-6.5.1-0-Q16-windows-dll Windows package, Delphi 7
Author: Pawel Kujawa, 2009
oku@chello.pl
1. Install ImageMagick - check "Install ImageMagickObject"
2. Run Delphi, import ImageMagickObject type library (Delphi 7 - menu: "Project"/"Import Type Library")
- this should create unit ImageMagickObject_TLB.pas
3. Optionally uncomment the example you want in "Test" procedure (resize example is default)
4. Compile project, run
5. Check the output in logo2.png (example code does not display any pictures just makes a conversion)
IMPORTANT:
To compile procedure Test() include ImageMagickObject_TLB, variants and activex units in uses section
IMPORTANT:
When you get "An application has made an attempt to load the C runtime library incorrectly" error you should upgrade:
"Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)"
http://www.microsoft.com/downloads/deta ... laylang=en
Tested on:
ImageMagick-6.5.1-0-Q16-windows-dll Windows package, Delphi 7
Author: Pawel Kujawa, 2009
oku@chello.pl
Code: Select all
// uses section for GUI application:
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ImageMagickObject_TLB, activeX, StdCtrls;
// Example procedure using COM object
procedure Test;
var
v : Variant;
im : TMagickImage;
begin
im := TMagickImage.Create(nil);
try
v := VarArrayCreate([0, 3], varVariant);
v[0] := 'logo:';
// rotation example
// v[1] := '-rotate';
// v[2] := '10';
// crop example - crop to 94x103 starting at 30, 25
// v[1] := '-crop';
// v[2] := '94x103+30+25';
// resize example - set width = 150 (will keep aspect ratio)
v[1] := '-resize';
v[2] := '150';
// output filename
v[3] := 'logo2.jpg';
// execution
im.Convert(PSafeArray(TVarData(v).VArray));
finally
im.Free;
end;
end;