Sign in Join
Wiki copytemporary

PascalMagick/ja

Bahasa Indonesia · English · Español · Français · Português · Русский · 中文(中国) · 日本語

概要

ImageMagick の概要

ImageMagick は、ビットマップイメージの作成、編集、組み立てを支援するフリーソフトウェアスイートです。GIF, JPEG, JPEG-2000, PNG, PDF, PhotoCD, TIFF, DPX などを含む、膨大な数の形式に対応しています(90を超えます)。イメージのクリッピング(クロップ)、色の変更、多様な効果の適用、イメージの回転・合成、文字・線・ポリゴン・楕円・ベジエ曲線のイメージへの追加、伸縮、回転をすることが可能です。 

このスイートはメジャーなオペレーティングシステム上で動作し、共通してコマンドラインから使用できるもので、しかも、このコマンドラインツールのパッケージは Linux の標準パッケージのひとつとして多くのディストリビューション向けに配布されています。

特徴及び機能:

ImageMagick Book

ImageMagick Tricks This fast paced and practical tutorial is packed with examples of photo manipulations, logo creation, animations, and complete web projects. With this book up your sleeve, you'll be creating spellbinding images from code in no time.

MagickWand について

MagickWand API は、ImageMagick チームお奨めのインターフェイスです。スイートの利用を容易にするプログラミングインターフェイスのひとつです。

MagickCore について

MagickCore API は、ImageMagick の下層インターフェィスです。

PascalMagick について

このポートは、MagickWand と Magick Core の両方について c 言語のヘッダーファイルを Pascal に焼き直したものです。

Screenshot

作者

Felipe Monteiro de Carvalho

Ángel Eduardo García

ライセンス

BSD スタイル及びGPL互換(GPLコンパチブル)。(訳注:「GPL互換(GPLコンパチブル)」という言葉は「GPLのソフトウェアと一緒に利用して新たなソフトウェアを作成可能」という意味ですから、ImageMagickのライセンスはGPLとは無関係なライセンスです。詳しくはこちらのGPLの両立性という項目を見てみてください)

ImageMagickのライセンスはここ で読めます。

Download

PascalMagick 0.4 is available here: http://sourceforge.net/project/showfiles.php?group_id=92177&package_id=174103&release_id=431432

Status: Magick Wand headers are complete and working on both Windows and Linux.

Installation

The current version of PascalMagick works on Windows and Linux. Beta testers are necessary for the Mac OS X version.

To start with, install ImageMagick binaries from the official website: http://www.imagemagick.org/script/binary-releases.php

Now download and unzip PascalMagick package (Instructions on the Download section above).

To check that everything is working, open the PascalMagick/wand/wanddemo.lpi project. Now go to the Project --> "Compiler Options dialog" and change the "Other Units" field to point to "../magick", so it can find the PascalMagick/magick/ImageMagick.pas file. After this you can compile and run the test program.

If the program is working, it will load the image.png image located on the same directory as he is, resize it and then save it as a jpg called image.jpg.

One Extra step is necessary on Linux: Rename the image.PNG to image.png due to case issues.

Demonstration program 1

pascal
{
  Demonstration program for the ImageMagick Library
pascal
This program was converted from c by: Felipe Monteiro de Carvalho
pascal
Usage: Just execute the program. It will resize the image.png image
on it??s directory to fit (106, 80) and convert it to a jpg.
pascal
Dez/2005
pascal
}
{Version 0.1}
program wanddemo;
pascal
{$mode objfpc}{$H+}
pascal
uses SysUtils, magick_wand, ImageMagick;
pascal
procedure ThrowWandException(wand: PMagickWand);
var
  description: PChar;
  severity: ExceptionType;
begin
  description := MagickGetException(wand, @severity);
  WriteLn(Format('An error ocurred. Description: %s', [description]));
  description := MagickRelinquishMemory(description);
  Abort;
end;
pascal
var
  status: MagickBooleanType;
  wand: PMagickWand;
begin
  { Read an image. }
pascal
MagickWandGenesis;
pascal
wand := NewMagickWand;
pascal
try
  status := MagickReadImage(wand, 'image.png');
  if (status = MagickFalse) then ThrowWandException(wand);
pascal
{ Turn the images into a thumbnail sequence. }
pascal
MagickResetIterator(wand);
pascal
while (MagickNextImage(wand) <> MagickFalse) do
 MagickResizeImage(wand, 106, 80, LanczosFilter, 1.0);
pascal
{ Write the image as MIFF and destroy it. }
pascal
status := MagickWriteImages(wand, 'image.jpg', MagickTrue);
if (status = MagickFalse) then ThrowWandException(wand);
pascal
finally
  wand := DestroyMagickWand(wand);
pascal
MagickWandTerminus;
pascal
end;
pascal
end.

Subversion

You can download the subversion version of this project using this command:

svn checkout http://svn.freepascal.org/svn/fpc/trunk/packages/base/imagemagick imagemagick

You can also download the full fpc 2.1.1 repository and it will be included.

Bug Reporting/Feature Request

Tests are necessary to verify if the bindings work with all versions of ImageMagick.

You can post Bug Reports / Feature Requests here:


Bug 1

There is an error in pixel_iterator.inc The correct declaration is function NewPixelIterator(wand: PMagickWand): PPixelIterator; cdecl; external WandExport;

also the following declarations should be added function PixelGetNextIteratorRow(iterator: PPixeliterator; var wandCount : Cardinal) : PPPixelWand; cdecl; external WandExport;

function PixelGetPreviousIteratorRow(iterator: PPixeliterator; var wandCount : Cardinal) : PPPixelWand; cdecl; external WandExport;

Cheers, Todd.

Status: Fixed on 0.3


Bug 2

There is a problem in "magick_wand.pas" and "ImageMagick.pas": the compiler option "{$PACKRECORDS C}" must be in the "{$ifdef FPC}[...]{$endif}". Otherwise the units do not compile with Delphi (Delphi 7 in my case).

Best wishes, Marc Geldon (PRO IT SYSTEMS)


Bug 3

your definition of "MagickGetImagePage" in magick_image.inc:

pascal
function MagickGetImagePage(wand: PMagickWand; width, height: PCardinal; x, y: Integer): MagickBooleanType; cdecl; external WandExport;

correct definition (x and y are "PInteger"!):

pascal
function MagickGetImagePage(wand: PMagickWand; width, height: PCardinal; x, y: PInteger): MagickBooleanType; cdecl; external WandExport;

Best wishes, Marc Geldon (PRO IT SYSTEMS)


Bug 4

ImageMagick 6.2.7 (don't know exactly what version) introduced a few changes in MagickWand record and others. Also, a few variable definitions were incorrectly declared, and some function imports missed the "cdecl", so they didn't work (like NewMagickWand()). I've fixed all this issues. Can I upload the changes somewhere?

Best regards, Arcnor

Hello, you can send it to me, and I´ll apply the changes. My e-mail is felipemonteiro.carvalho@gmail.com By the way, did you correct bugs 2 and 3 also? thanks a lot --Sekelsenmat 05:07, 8 June 2006 (CEST)


Bug 5

MagickNewImage parameters convention is cdecl.

Correct definition of MagickNewImage in magick_image.inc:

pascal
function MagickNewImage(wand: PMagickWand; const columns, rows: Cardinal;
 const background: PPixelWand): MagickBooleanType; cdecl; external WandExport;

Bug 6

MagickCompositeImage : Composite_wand is a PMagickWand constant.

Correct definition of MagickCompositeImage in magick_image.inc:

pascal
function MagickCompositeImage(wand: PMagickWand; const composite_wand: PMagickWand; 
 const compose: CompositeOperator; const x, y: Integer): MagickBooleanType; cdecl; external WandExport;

--RuBBeR 18:03, 3 July 2006 (CEST)

'''Status: Bugs 2-6 fixed on v0.4. Thanks to all (Arcnor)

Change Log

  1. Added 4 missing functions on magick_image.inc on fpc subversion, but no new release
  1. Last bugs fixed
  1. Minor fixes on the bindings
  1. MagickWand API fully translated
  2. Added a second demonstration program
  1. About 80% of the MagickWand API is translated
  2. The basic demonstration program is working well
  3. Only the very minimum necessary MagickCode headers were translated

Help

Please send help requests to the Lazarus Forum or the Lazarus mailling list.


From the Free Pascal wiki, page "PascalMagick/ja", as it stood on 2009-02-21 after a change by Malcome, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.