develooper Front page | perl.macosx | Postings from April 2002

Getting ImageMagick/PerlMagick to work

Thread Previous | Thread Next
From:
Peter N Lewis
Date:
April 12, 2002 02:07
Subject:
Getting ImageMagick/PerlMagick to work
Message ID:
p0510151db8dc52ce25b2@[203.47.34.3]
Hi all,

I finally got ImageMagick to install and work for me, perhaps this 
will help someone else...

I think pert of the problem might be that I have perl 5.6.1 installed.

Anyway, I eventually got it to install by using fink, but then it 
failed because it wanted _ParseGeometry, which I think is some sort 
of X windows thing, so I rebuilt it using:

fink fetch imagemagic

edit 
/sw/fink/dists/stable/main/finkinfo/graphics/imagemagick-5.4.1-3.patch 
and add a line to disable X windows support (add the line with_x=no, 
and change the 27 to 28 on the first line of the patch hunk).

@@ -7720,6 +7720,28 @@
      # FIXME: insert proper C++ library support
      ld_shlibs_CXX=no
      ;;
+  darwin* | rhapsody*)
+    case "$host_os" in
+    rhapsody* | darwin1.[012])
+      allow_undefined_flag_CXX='-undefined suppress'
+      ;;
+    *) # Darwin 1.3 on
+      allow_undefined_flag_CXX='-flat_namespace -undefined suppress'
+      ;;
+    esac
+    with_x=no
+
+    # FIXME: Relying on posixy $() will cause problems for
+    #        cross-compilation, but unfortunately the echo tests do not
+    #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
+    #        `"' quotes if we put them in here... so don't!
+    archive_cmds_CXX='$CC $(test .$module = .yes && echo -bundle || 
echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs 
$deplibs$linker_flags -install_name $rpath/$soname $verstring'
+    # We need to add '_' to the symbols in $export_symbols first
+    #_LT_AC_TAGVAR(archive_expsym_cmds, 
CXX)="$_LT_AC_TAGVAR(archive_cmds, CXX)"' && strip -s $export_symbols'
+    hardcode_direct_CXX=yes
+    hardcode_shlibpath_var_CXX=no
+    whole_archive_flag_spec_CXX='$convenience'
+    ;;
    aix4* | aix5*)
      if test "$host_cpu" = ia64; then
        # On IA64, the linker does run time linking by default, so we don't


After that just continue with the install

fink build imagemagic
fink install imagemagic

(you might have to do the build/install first to generate the patch 
file in the first place, I don't know where it came from).

Also, I found that "new Image::Magick" didn't work, but 
Image::Magick->new does.  This code now works for me:

use Image::Magick;

$image=Image::Magick->new;
$x = $image->Read( filename=>'/Users/peter/unix/game-org.jpg' );
warn "$x" if "$x";
$x = $image->Resize( geometry=>'640x480' );
warn "$x" if "$x";
$x = $image->Write( filename=>'/Users/peter/unix/game-out2.jpg', quality=>75 );
warn "$x" if "$x";
$x = $image->Resize( geometry=>'64x48' );
warn "$x" if "$x";
$x = $image->Write( filename=>'/Users/peter/unix/game-out2.gif' );
warn "$x" if "$x";
@$image = ();

Which is pretty cool if you want to generate web images or thumbs 
from large originals for example...

Hope this is useful.  Won't it be nice in a year or so when all this 
stuff just works out of the box!
    Peter.
-- 
<http://www.interarchy.com/>  <ftp://ftp.interarchy.com/interarchy.hqx>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About