What sim did is load a jpeg file and save the image twice: one rotated clockwise and the other counterclockwise.
The sizes are smaller because jpeg can be saved in different compression ratios.
A word about jpeg and loss-less:
If you load a jpeg the image is not loss-less because jpeg is lossy to start with.
When an jpeg file is loaded into a memory buffer you get the pixels, but from a lossy image.
(because the buffer was filled by a jpeg)
The only way to get a loss-less image rotated:
If you have a raw file from a camera and load it into a memory buffer you get raw pixels in a loss-less format.
Because the image information in a jpeg file is lossy the memory buffer will never be loss-less.
(because the original file was lossy...)
However once an image file is loaded into a memory buffer and image information is rotated the information is the same, just rotated...
If you save the buffer to a file and choose a jpeg format you can specify the compression ratio.
But nevertheless jpeg is lossy no matter which compression ratio is chosen.
The image rotation function itself is loss-less in the sense that no image information is lost during rotation, but saving the image information to a jpeg file is lossy...ValaDoc says:
JPEG images can be saved with a "quality" parameter; its value should be in the range [0,100]
If loss-less is needed a different file format needs to be chosen.