detecting failure with convert
Posted: 2011-07-21T14:49:27-07:00
I have an odd problem. I'm trying to use 'convert' to deal with about 100k TIFF images. All the TIFFs are single page, but we are converting them to multi-page TIFFs, so I'm using the following command:
And it works perfectly. The problem arises from the fact that I know that in my 100k documents, there are bad files. So in the above example, if page2.tiff is corrupt, and convert can't read it, it still generates result.tiff as a two page document using page1.tiff and page3.tiff.
The ideal solution for me is that if any of the supplied pages are unreadable, the command fails with no generated files.
I do know that I can watch STDERR, but since my files generate all sorts of warnings, most of which don't constitute a failure to process the images, it's hard to know what actually do constitute an error.
I suspect my real solution is to stop trying to use 'convert', and use php/perl/python and the associated imagemagick library, but I was hoping to keep this simple.
Any thoughts?
Geof
Code: Select all
convert -monochrome -compress Group4 page1.tiff page2.tiff page3.tiff result.tiff
The ideal solution for me is that if any of the supplied pages are unreadable, the command fails with no generated files.
I do know that I can watch STDERR, but since my files generate all sorts of warnings, most of which don't constitute a failure to process the images, it's hard to know what actually do constitute an error.
I suspect my real solution is to stop trying to use 'convert', and use php/perl/python and the associated imagemagick library, but I was hoping to keep this simple.
Any thoughts?
Geof