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-thr ead-multi/ auto/Image /Magick/Ma gick.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-thre ad-multi/D ynaLoader. 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) ;
}
Does anyone have any suggestions?
thank you
Steve
Can't load '/usr/lib/perl5/site_perl/
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)
}
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/03 modlist.da ta.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
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/
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.
ASKER
Fedora Redhat 4
thank you
Steve
thank you
Steve
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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
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
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
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.
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