I want to propose a small modification to the pgblur script, right after assigning the command line parameters to variables:
set inp = "$3"
set Lzero = `pextrem $inp:q | tail -1 | rcalc -e '$1=if((.265*$3+.67*$4+.065*$5)-1e-5,0,1)'`
if ( $Lzero ) then
exec cat $inp:q
This outputs the original image if all pixel values are zero (well, below my arbitrarily chosen threshold) rather than producing an error. The motivation is that I want to filter frames resulting from CBDM. One could, of course, keep this test outside the script, but this eliminates one error condition.