Page 1 of 1
Mogrify, on fail - delete
Posted: 2013-07-17T05:56:57-07:00
by sergeda
I'm having folder with pictures in subdirs. I want to change the width of all pictures. For this I use command:
Code: Select all
find . \( -name "*.jpg" -o -name "*.png" \) -exec mogrify -thumbnail 250 * {} \;
This working fine exept there are some incorrect files at wich mogrify complains.
I would like to delete those bad files if mogrify can't resize them. Is it possible?
Re: Mogrify, on fail - delete
Posted: 2013-07-17T20:38:52-07:00
by fmw42
Post an example image that mogrify will not process. Do you know why it fails? Is the file corrupt? Can you process the file with convert rather than mogrify?
Can you get results from
identify yourimage
If that fails, then you would be able to identify such files by looping over each file in your directory and testing whether identify fails or not. Get rid of all those files. Then use your command with mogrify on all the good files.
Re: Mogrify, on fail - delete
Posted: 2013-07-17T23:46:58-07:00
by sergeda
fmw42 wrote:Post an example image that mogrify will not process. Do you know why it fails? Is the file corrupt? Can you process the file with convert rather than mogrify?
Can you get results from
identify yourimage
If that fails, then you would be able to identify such files by looping over each file in your directory and testing whether identify fails or not. Get rid of all those files. Then use your command with mogrify on all the good files.
There are just number of corrupted images. I like your idea to identify and delete failed images first but don't know how to acomplish this.
This will identify all files:
but how to add verification of results and delete part I don't know.
Please help someone more expririenced with shell scripts.
Re: Mogrify, on fail - delete
Posted: 2013-07-18T09:42:37-07:00
by fmw42
First let us know if identify fails for your bad images. Or provide a link to one example that fails so we can figure out the best way to test them and remove them.
Re: Mogrify, on fail - delete
Posted: 2013-07-18T23:07:14-07:00
by sergeda
fmw42 wrote:First let us know if identify fails for your bad images. Or provide a link to one example that fails so we can figure out the best way to test them and remove them.
Yes, identity fails for that images.
Re: Mogrify, on fail - delete
Posted: 2013-07-19T09:47:53-07:00
by fmw42
sergeda wrote:fmw42 wrote:First let us know if identify fails for your bad images. Or provide a link to one example that fails so we can figure out the best way to test them and remove them.
Yes, identity fails for that images.
Can you provide the error message or how it fails? It would be best to provide a link to one image that fails, so we can test and come up with a loop that will delete or move those images to another directory.