Added mogrify step using imagemagick for jpeg encoding