Add qmax option

Allow jpeg quality to increase towards qmax if input resolution is
insufficient.
'scale' parameter improvements
Debug messages improvements