0

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?

tsp
  • 61
  • 7
  • This isn't really clear. You have an Image, you have an RGB Array and you have a Quantization Array. What are each of those? Are you using a librar to handle jpgs? – matt Apr 30 '22 at 11:48
  • Image refers to the binary of a file in a format such as jpg/png. RGB Array refers to an array of uint8 data type with values 0-255 used for image processing in libraries like opencv like numpy arrays. Quantization Array refers to the result obtained by dividing the DCT coefficient by the quantization values defined in the luminance and chrominance quantization tables. Additionally I'm only considering rotations of 0/90/180/270 degrees – tsp Apr 30 '22 at 12:08
  • That makes sense. Why is this on stack overflow? Are you using a particular language or library? Here is a question for performing the operation in java https://stackoverflow.com/questions/706665/lossless-jpeg-rotate-90-180-270-degrees-in-java – matt Apr 30 '22 at 12:13
  • 2
    I think you want `jpegtran` https://linux.die.net/man/1/jpegtran – Mark Setchell Apr 30 '22 at 13:28

0 Answers0