Add alpha and background color support

Covers both input and output. Conflicts with at least one previous PR, probably more. Supersedes PR #7.