Page 1 of 1

Using mogrify to strip rubbish from image files with loss

Posted: 2014-10-24T03:37:18-07:00
by hollymcr
I'm looking to post-process files recovered from corrupt/damaged disks using photorec. One of the problems with its type of recovery is that it can't always detect the end of a file, and so (for example) an 500byte .gif file might be recovered as a 1.5GB file...

If I run:

Code: Select all

mogrify recovered.gif
.. then I get the 500 byte file back.

My question is: What options do I need to give mogrify, in the general case (ideally for all image types that it supports, but certainly common ones like jpg,png,gif) to ensure that all it does is load the file and save an identical copy (other than stripping off the rubbish). I don't want to lose meta data or re-encode/re-compress the image in any way. Indeed, is it sufficient to just not tell it to do anything (as above) to be sure that it does nothing, which would normally be pointless but in this case extremely useful?

Re: Using mogrify to strip rubbish from image files with los

Posted: 2014-10-24T13:17:19-07:00
by snibgo
I don't think IM ever guarantees to copy all the metadata. Exiftool might do what you want, either by itself, or using exiftool to copy all the metadata, IM to convert it, and exiftool to restore the metadata. Or convert with IM, then use exiftool to copy metadata from the corrupt file to the new one.