Segmentation Fault
I have recently put together a new comoputer, I think it's a 2GHZ athalon (quite an improvement over the 233 MHZ pentium I had been using). I have installed Redhat 8.0, and it seems to work for the most part. I have a perl script that I use to resize jpg files, which uses ImageMagick, and it works on the three other computers I use, all ao which have some version or other of Redhat on them. When I run this little script on my new computer it tells me segmentation fault. First, what, more or less, is a segmentation fault?
I have tried to troubleshoot the program by commenting out all of the lines that reffered to ImageMagick, and then running the program to see which line was causing the error. It seems that the offending line is the following: $image->Read(file=>\*PICS); I don't know if this is a hardware problem or a software problem, and I have no idea how to proceed. I would deeply appreciate any help. Thanks |
What is the error message?
|
A segfault (=Segmentation Fault) is an unexpected error in a programm routine. Simply: Your programm crashed.
|
Quote:
|
The error message is simply "Segmentation fault" with exactly that capitalization(or lack thereof). It is a very simple script (I'm a simple programmer) so it seems unlikely that it would be a change in perl or the perl interface to ImageMagick. Do you think that I should contact the ImageMagick people and ask them? I will include the whole script since it is so short. I use it all the time, and if anyone else wants to use it, feel free. You have to make sure that you have the perl interface to ImageMagick installed.
#!/usr/bin/perl #Program to resize all .jpg files in current directory and save them as a.jpg. first argument is height, second argument is width. $width=pop(@ARGV); $height=pop(@ARGV); use Image::Magick; $image = Image::Magick->new; @files=`ls *.jpg`; foreach $file (@files){ $file=~s/.jpg//; chomp ($file); open PICS, "<${file}.jpg" or die "cannot open ${file}.jpg"; binmode PICS; $image->Read(file=>\*PICS); close PICS; $image->Resize(width=>$width, height=>$height); print "${file}a.jpg\n"; open PICS, ">${file}a.jpg" or die "cannot open ${file}a.jpg"; $image->Write(file=>PICS); close PICS; undef @$image; } |
Quote:
Quote:
|
|
All times are GMT -5. The time now is 11:37 AM. |