本文介绍了JPEG压缩图像可以在不损失质量的情况下旋转吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JPEG是一种有损压缩方案,因此解压缩操作重新压缩通常会进一步降低每个步骤的图像质量。 是否可以旋转JPEG图片,而不会导致进一步的损失?从我知道的JPEG算法,我天真似乎可以避免进一步的损失与一点努力。

JPEG is a lossy compression scheme, so decompression-manipulation-recompression normally reduces the image quality further for each step. Is it possible to rotate a JPEG image without incurring further loss? From what little I know of the JPEG algorithm, it naively seems possible to avoid further loss with a bit of effort. Which common image manipulation programs (e.g. GIMP, Paint Shop Pro, Windows Photo Gallery) and graphic libraries cause quality loss when performing a rotation and which don't?

推荐答案

是的,在某些情况下是可能的:在尺寸为8的倍数的图像上进行90度旋转和翻转.JPEG算法的核心 - 有损部分 - 涉及破坏图像转换为8x8像素块,对块执行,然后量化结果。还有一些颜色空间转换和在这之上的块的无损压缩。

Yes, it is possible for certain cases: 90-degree rotations and flips on images with dimensions that are a multiple of 8. The heart of the JPEG algorithm -- the lossy part -- involves breaking the image into 8x8 pixel blocks, performing a discrete cosine transform on the block and then quantizing the result. There's also some color space conversion and lossless compression of the blocks on top of this.

旋转或翻转8x8块将给予具有相同基本系数的DCT,但可能转置和/或根据转换具有一些符号变化。因此,无损地旋转或翻转图片的基本步骤包括:

Rotating or flipping an 8x8 block will give a DCT with the same basic coefficients, but possibly transposed and/or with some sign changes depending on the transformation. So the basic steps to rotate or flip an image losslessly would involve:


  1. 解压缩并提取块

  2. 将每个块的DCT系数转置和/或符号翻转

  3. 将块重新整理为新顺序(否则8x8块将旋转,但仍在旧位置) >
  4. 使用无损压缩步骤重新压缩所有文件。

这篇关于JPEG压缩图像可以在不损失质量的情况下旋转吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 18:24