For JPEG for example, the command jpegtran is able to losslessly perform several operations like flip, rotate by a multiple of 90 degrees and others.
From its man page:
jpegtran works by rearranging the compressed data (DCT coefficients), without ever fully decoding the image. Therefore, its transformations are lossless: there is no image degradation at all, which would not be true if you used djpeg followed by cjpeg to accomplish the same conversion.
For JPEG for example, the command
jpegtran
is able to losslessly perform several operations like flip, rotate by a multiple of 90 degrees and others. From its man page: