Dynamic Print Stream Classification and Optimal JPEG Compression