A Rate-Distortion-Classification Approach for Lossy Image Compression