Fixed alpha handling when writing jpegs.