How machine detects corrupted image automatically??

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
pkashrai

How machine detects corrupted image automatically??

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How machine detects corrupted image automatically??

Post by anthony »

Run identify on the downloaded image, junk its output and look at the commands return status.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
pkashrai

Re: How machine detects corrupted image automatically??

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How machine detects corrupted image automatically??

Post by magick »

Type
  • echo $status
after you run the identify command. A status of 1 means the image is corrupt.
pkashrai

Re: How machine detects corrupted image automatically??

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How machine detects corrupted image automatically??

Post by anthony »

What shell. if you are using bash use $? instead of $status

check you shell manual.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
pkashrai

Re: How machine detects corrupted image automatically??

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How machine detects corrupted image automatically??

Post by magick »

Use this command (requires a modern version of ImageMagick):
  • identify -regard-warnings 551933corrupt.jpg
pkashrai

Re: How machine detects corrupted image automatically??

Post by pkashrai »

ThankYou very much for your great help!!
The command you specified worked for me..
:D :lol:

With Regards
Prakash Rai
mandelbr0t
Posts: 1
Joined: 2011-11-12T10:59:01-07:00
Authentication code: 8675308

Re: How machine detects corrupted image automatically??

Post by mandelbr0t »

With ImageMagick 6.6 only detect a corrupted image with the -verbose option.
Post Reply