Added jpeg encoding.