JPEG 压缩图像可以在不损失质量的情况下旋转吗? [英] Can a JPEG compressed image be rotated without a loss in quality?

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

问题描述

JPEG 是一种有损压缩方案,因此解压-操作-再压缩通常会进一步降低每一步的图像质量.是否可以在不引起进一步损失的情况下旋转 JPEG 图像?根据我对 JPEG 算法的了解很少,似乎可以通过一些努力来避免进一步的损失.哪些常见的图像处理程序(例如 GIMP、Paint Shop Pro、Windows 照片库)和图形库在执行旋转时会导致质量下降,哪些不会?

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?

推荐答案

是的,在某些情况下是可能的:90 度旋转和图像翻转.JPEG 算法的核心——有损部分——涉及将图像分成 8x8 像素块,执行 对块进行离散余弦变换,然后量化结果.在此之上还有一些色彩空间转换和块的无损压缩.

Yes, it is possible for certain cases: 90-degree rotations and flips on images. 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 压缩图像可以在不损失质量的情况下旋转吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆