Link to home
Start Free TrialLog in
Avatar of sai4
sai4

asked on

Image Magick, perl- Can't get working

Hi I just tried to install Image Magick to shrik some images, but I get the following error when I try to run my perl script?
Does anyone have any suggestions?

thank you
Steve


Can't load '/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/auto/Image/Magick/Magick.so' for module Image::Magick: libMagick.so.10: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.6/i386-linux-thread-multi/DynaLoader.pm line 230.
 at ./reize.pl line 4
Compilation failed in require at ./resize.pl line 4.
BEGIN failed--compilation aborted at ./resize.pl line 4.

------------------code below-------------------------------------------------

#!/usr/bin/perl
use strict;
use warnings;
use Image::Magick;  #this is the line the error occurs at



my $path = glob("./");

my @pageName = ();
opendir(DIR,$path) or die "can't open dir $!";
my @files = grep{/\.bmp|.JPG$/} readdir(DIR);
closedir(DIR);


my $image = Image::Magick->new();  #contains an image
foreach $image_file (@files){


    $image->Read($image_file);
    $image->Resize(geometry => '120x90');
    $image->Write($image_file);
}
Avatar of Kelly Black
Kelly Black
Flag of United States of America image

What operating system are you using? ( I know Linux but flavor)

Try this. From command line on the server type

perl -e 'use Image::Magick;'

If you run that command and it comes back with no errors, the module is working. If the module errors, then use this command to install it:

perl -MCPAN -e 'install Image::Magick'

If installing the module fails, it's likely a software package missing (which with the shared .so config error above seems likely). At this point you use the package manager for whatever distribution you have to install Image Magick. For example on a Mandriva box it would be

urpmi ImageMagick

Also, if you have installed them, and you are still getting errors from Perl, post back and I  can provide you with more information.

Regards,

~K Black
Avatar of sai4
sai4

ASKER

hi K Black

perl -e 'use Image::Magick;'     gave me the same error

so I did
perl -MCPAN -e 'install Image::Magick'

got

Fetching with LWP:
  ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz
Going to read /home/steve/.cpan/sources/modules/03modlist.data.gz
Going to write /home/steve/.cpan/Metadata
Image::Magick is up to date.


I then tried


perl -e 'use Image::Magick;'   but it gave me  the same error


any suggestions?

Thank you
Steve

Refer to previous post. You probably need to install core  components on the Operating System for ImageMagick. Which distro of Linux are you using? Then I can give you the steps to get it done.

Avatar of sai4

ASKER

Fedora Redhat 4

thank you
Steve
ASKER CERTIFIED SOLUTION
Avatar of Kelly Black
Kelly Black
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think you have the API (application programing interface) for ImageMagick (aka PerlMagick) installed, but you don't have the application it interfaces with (ImageMagick) installed.

See http://www.imagemagick.org/script/binary-releases.php#unix.
sai4,
You have installed IM as a non-root user and your perl is looking in the standard root installed location - so it is not found when you run perl.
D
This link shows the way to do cpan install as non-root user.
http://sial.org/howto/perl/life-with-cpan/non-root/
D
On a different note, ImageMagick is not always compatible with system libraries, and you may do better using GD.
See e.g. http://search.cpan.org/dist/GD/
D
I would shell out to ImageMagick rather than perlMagic - this way you can test that all works well at the shell yourself rather than needing to wonder
to me it seems clear with this type of thing that one of the solutions is being used and that the questioner has just forgotten to mention it.