The proper way to make lossy encoders is to minimize the mutual information between the original image and the encoding, while minimizing the necessary error correction between the reconstructed image and the original image. It's difficult to measure the mutual information, but you can make an adversarial neural network that approximates it. For the error correction bits, if you assume a normal source of randomness you can just use the mean-squared error, but it's probably better to output a full distribution, and assume your
source image has a normal source of randomness:
pixel value = p ---> "correct" distribution = exp(-(x-p)^2 / temperature)
Then you can take a KL-divergence. The temperature should be another parameter in your model.