• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Introduction
2
3    PerlMagick, is an objected-oriented Perl interface to ImageMagick.
4    Use the module to read, manipulate, or write an image or image sequence
5    from within a Perl script. This makes it suitable for Web CGI scripts. You
6    must have ImageMagick 7.0.0 or above installed on your system for this
7    module to work properly.
8
9    See
10
11        https://imagemagick.org/script/perl-magick.php
12
13    for additional information about PerlMagick.  If you have problems, go to
14
15        https://github.com/ImageMagick/ImageMagick/discussions
16
17    for help.  For instructions about installing ImageMagick, see
18
19        https://imagemagick.org/
20
21
22Installation
23
24    Get the PerlMagick distribution and type the following:
25
26        gunzip ImageMagick-7.0.10-58.tar.gz
27        tar xvf ImageMagick-7.0.10
28
29    Follow the ImageMagick installation instructions in INSTALL-unix.txt
30		then type
31
32      cd PerlMagick
33
34    Next, edit Makefile.PL and change LIBS and INC to include the appropriate
35    path information to the required libMagick library. You will also need
36    library search paths (-L) to JPEG, PNG, TIFF, etc. libraries if they were
37    included with your installed version of ImageMagick. If an extension
38    library is built as a shared library but not installed in the system's
39    default library search path, you may need to add run-path information
40    (often -R or -rpath) corresponding to the equivalent library search
41    path option so that the library can be located at run-time.
42
43    To create and install the dymamically-loaded version of PerlMagick
44    (the preferred way), execute
45
46        perl Makefile.PL
47        make
48        make install
49
50    To create and install a new 'perl' executable (replacing your existing
51    PERL interpreter!) with PerlMagick statically linked (but other libraries
52    linked statically or dynamically according to system linker default),
53    execute
54
55        perl Makefile.PL
56        make perl
57        make -f Makefile.aperl inst_perl
58
59    or to create and install a new PERL interpreter with a different name
60    than 'perl' (e.g. 'PerlMagick') and with PerlMagick statically linked
61
62        perl Makefile.PL MAP_TARGET=PerlMagick
63        make PerlMagick
64        make -f Makefile.aperl inst_perl
65
66    See the ExtUtils::MakeMaker(3) manual page for more information on
67    building PERL extensions (like PerlMagick).
68
69    For Windows systems, type
70
71        perl Makefile.nt
72        nmake install
73
74    For Unix, you typically need to be root to install the software.
75    There are ways around this.  Consult the Perl manual pages for more
76    information. You are now ready to utilize the PerlMagick routines from
77    within your Perl scripts.
78
79Installation - Win32 Strawberry perl
80
81   On Win32 Strawberry perl the prefered way of installing PerlMagick is the
82   following:
83
84   1) Download and install ImageMagick Windows binaries from
85      https://imagemagick.org/script/binary-releases.php#windows
86
87   2) You HAVE TO choose dynamic (DLL) ImageMagick binaries.  Note: it is not
88      possible to mix 32/64bit binaries of perl and ImageMagick
89
90   3) During installation select that you want to install ImageMagick's
91      development files (libraries+headers)
92
93   4) You NEED TO have ImageMagick's directory in your PATH.  Note: we are
94      checking the presence of convert.exe or identify.exe tools
95
96   5) You might need Visual C++ Redistributable Package installed on your
97      system.  See instructions on ImageMagick's Binary Release webpage.
98
99   6) If you have all prerequisites 1)...5) you can simply install
100      ImageMagick by running: cpan -i Image::Magick
101
102
103Testing PerlMagick
104
105    Before PerlMagick is installed, you may want to execute
106
107        make test
108
109    to verify that PERL can load the PerlMagick extension ok.  Chances are
110    some of the tests will fail if you do not have the proper delegates
111    installed for formats like JPEG, TIFF, etc.
112
113    To see a number of PerlMagick demonstration scripts, type
114
115        cd demo
116        make
117
118
119Example Perl Magick Script
120
121    Here is an example script to get you started:
122
123        #!/usr/bin/perl
124        use Image::Magick;
125
126        $q = Image::Magick->new;
127        $x = $q->Read("model.gif", "logo.gif", "rose.gif");
128        warn "$x" if $x;
129
130        $x = $q->Crop(geom=>'100x100+100+100');
131        warn "$x" if $x;
132
133        $x = $q->Write("x.gif");
134        warn "$x" if $x;
135
136    The script reads three images, crops them, and writes a single image
137    as a GIF animation sequence.
138