Magickwand and Delphi 2009

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
firstfriday

Magickwand and Delphi 2009

Post by firstfriday »

Hello,
has anybody used delphi2009 and Magickwand? I cannot get it working.
The MagickReadImage function return 0 and the error description returns just unreadable characters.
Has somebody an idea?
Thanks
edgar

Code: Select all

//uses  ImageMagick,magick_wand,
// wrapper from http://sourceforge.net/project/showfiles.php?group_id=92177&package_id=174103&release_id=431432

procedure TfrmPicDialog.aclTestExecute(Sender: TObject);
var
  status: MagickBooleanType;
  wand: PMagickWand;

  procedure ThrowWandException(wand: PMagickWand);
  var
    description: PChar;
    severity: ExceptionType;
  begin
    description := MagickGetException(wand, @severity);
    showmessage(Format('An error ocurred. Description: %s', [description]));
    description := MagickRelinquishMemory(description);
    Abort;
  end;

begin
  MagickWandGenesis;
  wand := NewMagickWand;
  try
    status := MagickReadImage(wand,'image.png');
    if (status = MagickFalse) then ThrowWandException(wand);
    MagickResetIterator(wand);
    while (MagickNextImage(wand) <> MagickFalse) do
     MagickResizeImage(wand, 106, 80, LanczosFilter, 1.0);
    status := MagickWriteImages(wand, 'image.jpg', MagickTrue);
    if (status = MagickFalse) then ThrowWandException(wand);
  finally
    wand := DestroyMagickWand(wand);
    MagickWandTerminus;
  end;
end;
firstfriday

Re: Magickwand and Delphi 2009

Post by firstfriday »

Found out myself. the wrapper works with char since d2009 works with widechar by default all calls must be ansichar.
Post Reply