Updated usage and comments
Added jpeg encoding support