Page 1 of 1

How machine detects corrupted image automatically??

Posted: 2007-02-18T22:24:01-07:00
by pkashrai
When I wanted to identify corrupted image, the program ends with the last messages
identify: Premature end of JPEG file 'corrupt.jpg'.
identify: Corrupt JPEG data: premature end of data segment 'corrupt.jpg'.

where corrupt.jpg is name of the image I used.As I think, this gives the image is corrupted to the viewer.But now I wanted the machine to detect the corrupted image automatically as soon as the image is downloaded(e-mail attachments). What should I do? Is there any commands so that the machine detects the corrupted image? Please help!!


With Regards
Prakash Rai

Re: How machine detects corrupted image automatically??

Posted: 2007-02-19T20:28:16-07:00
by anthony
Run identify on the downloaded image, junk its output and look at the commands return status.

Re: How machine detects corrupted image automatically??

Posted: 2007-02-20T04:25:22-07:00
by pkashrai
Thanks for your reply.

I issued the command as follows:

Code: Select all

identify -verbose corrupt.jpg >log.txt 2>&1
and I got the log.txt file. But I don't see any STATUS there. I am sure that corrupt.jpg file is a corrupted file. How and where can I check that status? What status I need to check ? Eagerly waiting for your reply!!

With Regards
Prakash Rai

Re: How machine detects corrupted image automatically??

Posted: 2007-02-20T08:06:27-07:00
by magick
Type
  • echo $status
after you run the identify command. A status of 1 means the image is corrupt.

Re: How machine detects corrupted image automatically??

Posted: 2007-02-20T22:11:48-07:00
by pkashrai
Thank U once more for your quick response.

I tried but didn't get any status. The following is what I got.

/************************************************/
server:/home/proj/images # identify corrupt.jpg
identify: Corrupt JPEG data: premature end of data segment `corrupt.jpg'.
corrupt.jpg JPEG 406x491 DirectClass 67kb 0.010u 0:01
server:/home/proj/images # echo $status

server:/home/proj/images #
/***************************************************/

Actually we have Suse installed in out server and I am using SSH Tectia Client.

Thank you.

With regards,
Prakash Rai.

Re: How machine detects corrupted image automatically??

Posted: 2007-02-21T21:03:45-07:00
by anthony
What shell. if you are using bash use $? instead of $status

check you shell manual.

Re: How machine detects corrupted image automatically??

Posted: 2007-02-22T01:50:01-07:00
by pkashrai
Thanks for your response..I works for me..Status 1 is displayed when program terminates unexpectedly..But still could not able to get the status 1 with my image.I think the image is corrupted. Can you please try this with the following image? The link for the image is:
http://www.imageboo.com/images/551933corrupt.jpg


With Regards
Prakash Rai

Re: How machine detects corrupted image automatically??

Posted: 2007-02-22T08:30:35-07:00
by magick
Use this command (requires a modern version of ImageMagick):
  • identify -regard-warnings 551933corrupt.jpg

Re: How machine detects corrupted image automatically??

Posted: 2007-02-23T00:51:25-07:00
by pkashrai
ThankYou very much for your great help!!
The command you specified worked for me..
:D :lol:

With Regards
Prakash Rai

Re: How machine detects corrupted image automatically??

Posted: 2011-11-12T11:03:27-07:00
by mandelbr0t
With ImageMagick 6.6 only detect a corrupted image with the -verbose option.