'jpg rotate without quality change

I know that jpg follows the following method when saving images.

  1. DCT transformation
  2. Quantization
  3. Lossless Compression

Usually when rotating an image

  1. Image -> RGB Array
  2. Rotate
  3. RGB Array -> Convert to Image

I don't want to add loss to the image in the process of converting the file to RGB.

Perhaps there is a way to go through the following steps:

  1. Image -> Quantization Array
  2. Rotate
  3. Quantization Array -> Image

Any good way?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source