JPEG lossless transform

JPEG lossless transform

In short, is it supported in UIC or IPP?

I need a lossless rotation of JPEG image.

9 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I asked this question a while back, and the answer was no.
I use my own JpegTrans.dll, compiled from IJG, however I not sure if it can handle anything outside baseline jpeg.


What do you call as lossless JPEG rotation? If that is technique used in IJG library than it is not mathematically lossless and is not necessary faster then just full decode and rotate.

What widely called as JPEG lossless rotate is partial decoding up to final up-sampling and color conversion steps, that is:

1. huffman decode of DCT coefficients
2. dequantization
3. inverse DCT transform (which brings data from frequency domain back to time domain and produceimage pixels)
- here is the point where it is possible to rotatepixel data before the final step, which is up-sampling (if needed) and color conversion (if needed)

First, the only mathematically lossless operation here is huffman decoding.
Second, performance of IPP implementation of up-sampling and color-conversion functions reduce difference in time required to that "lossless rotate operation" and just naive full decoding and rotate.



I should perhaps said "reversible" instead of "lossless" and clarified that I mean 90, 180 and 270 rotation and flipping.

As far as I know JPEGTRAN does not perform dequantization and IDCT, but instead transforms MCU blocks, AC coefficient matrices, and changes chroma subsampling orientation.

Lossless crop is also possible as long as you crop along MCU boundaries.

Finally, chrominance channels can be discarded for simple and fast grayscale conversion without recompression.

You might want to read through this carefully:

Full decompression and rotation is fast enough for display, but I want to be able to save the rotated file without the loss of quality associated with full JPEG recompression.

Hm, do you mean jpegtran do all these reversible flipping in frequency domain?


Sure, that's the whole point.

If you don't believe me, try it and compare results of conventional rotation with recompression and reversible rotation. There are a lot of programs supporting reversible transforms nowadays.

Perhaps you should specify that you want rotation angles be x90 degrees. Though it could be lossless for 45 degree increments too with a little more work. You can not do it for an abitrary angle.

I did in this post.

You are wrong in this statement. Lossless jpeg rotation means only huffman decoding, DCT rotation/mirror, huffman encoding.

To put it simply, no new jpeg artifacts are introduced with lossless rotation.
You can repeat lossless rotation infinitely without destroying the image.

The only issue are the right and bottom borders, because they are not on an 8x8 boundary.
If the original image is modulo 8x8, rotation/mirror is purely lossless.

Leave a Comment

Please sign in to add a comment. Not a member? Join today