Bashscript: Pipe errors and warnings to variable or file

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
humbleweed
Posts: 1
Joined: 2010-02-03T07:51:27-07:00
Authentication code: 8675309

Bashscript: Pipe errors and warnings to variable or file

Post by humbleweed »

I'm using IM also for quality management in several digitisation projects. I.e. writing image attributes to csv files or to db tables or comparing image data to given profiles.
A problem is catching errors and warnings in a conveniant way. I found no way to write these messages to destinations other than to the primary terminal window.

Does anybody know about ways to write errors and warnings to variables or files?

Hunbleweed
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bashscript: Pipe errors and warnings to variable or file

Post by magick »

The ImageMagick API provides methods for an alternative exception handler. From the command line you must use your shell features to redirect the errors / warnings to another process or a file on disk. The method depends on the OS and shell you are using.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Bashscript: Pipe errors and warnings to variable or file

Post by fmw42 »

try

convert.... 2>&1 error.txt
Post Reply