blob: 21cb3909d65c62f7c96a4cb6cb98ca93a401d0da [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001Introduction
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
cristyf7ee84a2013-02-14 12:46:11 +00006 must have ImageMagick 7.0.0 or above installed on your system for this
cristy3ed852e2009-09-05 21:47:34 +00007 module to work properly.
8
9 See
10
11 http://www.imagemagick.org/script/perl-magick.php
12
cristye3ea2ad2009-11-27 00:08:04 +000013 for additional information about PerlMagick. If you have problems, go to
14
15 http://www.imagemagick.org/discourse-server/viewforum.php?f=7
16
17 for help. For instructions about installing ImageMagick, see
cristy3ed852e2009-09-05 21:47:34 +000018
19 http://www.imagemagick.org/
20
cristy3ed852e2009-09-05 21:47:34 +000021
22Installation
23
24 Get the PerlMagick distribution and type the following:
25
cristyf7ee84a2013-02-14 12:46:11 +000026 gunzip ImageMagick-7.0.0-0.tar.gz
27 tar xvf ImageMagick-7.0.0
cristy3ed852e2009-09-05 21:47:34 +000028
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
cristyf912c452009-10-20 12:33:26 +000079Installation - 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 http://www.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
cristy3ed852e2009-09-05 21:47:34 +0000102
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.