bitmap - 是否可以将 JPG 制成的 BMP 重新编码回 JPG 而不会降低质量?

标签 bitmap jpeg bmp image-compression

有时我将 JPG 图像保存为未压缩的位图 (BMP/PNG),以在更改图像时保持质量。

我想知道,理论上是否可以将位图重新编码回其原始 JPG 格式,而不会损失任何质量(我编辑的区域除外)?

编辑:我想以某种方式强制它找到该 BMP 数据块的原始 JPG 信息设置,从而从 BMP(以前是 JPG)生成 JPG,与原始 JPG 没有任何区别。我对 JPG 格式知之甚少,无法说它是否可能,但我想不出为什么不,至少在某些 有限有时间你可以蛮力 8x8 块吗?

最佳答案

JPEG 压缩是有损的,因此当您将其重新编码为 JPEG 时,您将丢失 .bmp 中的一些信息。如果图像是微不足道的(例如 1 个黑色像素 1 个黑色全黑,例如 1 个像素),您可以重新编码而不会丢失。

您可以看到多次重新编码 JPEG 的示例 here .

您可以对 JPEG 进行一些无损操作,来自 wikipedia :

A number of alterations to a JPEG image can be performed losslessly (that is, without recompression and the associated quality loss) as long as the image size is a multiple of 1 MCU block (Minimum Coded Unit) (usually 16 pixels in both directions, for 4:2:0 chroma subsampling). Utilities that implement this include jpegtran, with user interface Jpegcrop, and the JPG_TRANSFORM plugin to IrfanView.

Blocks can be rotated in 90 degree increments, flipped in the horizontal, vertical and diagonal axes and moved about in the image. Not all blocks from the original image need to be used in the modified one.

The top and left edge of a JPEG image must lie on a 8 × 8 pixel block boundary, but the bottom and right edge need not do so. This limits the possible lossless crop operations, and also prevents flips and rotations of an image whose bottom or right edge does not lie on a block boundary for all channels (because the edge would end up on top or left, where – as aforementioned – a block boundary is obligatory).

When using lossless cropping, if the bottom or right side of the crop region is not on a block boundary then the rest of the data from the partially used blocks will still be present in the cropped file and can be recovered.

It is also possible to transform between baseline and progressive formats without any loss of quality, since the only difference is the order in which the coefficients are placed in the file.

Furthermore, several JPEG images can be losslessly joined together, as long as the edges coincide with block boundaries.

关于bitmap - 是否可以将 JPG 制成的 BMP 重新编码回 JPG 而不会降低质量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17172293/

相关文章:

c# - Wpf 将动态位图添加到图像

java - 如何在 ImageView android上绘制文本

html - 使用图像标签在网页上显示原始像素阵列

java - 在 Java 中使用 ImageIO 设置 jpg 压缩级别

c++ - 在 C++ 中手动编写 Bmp 文件很困难(使用 Xcode)

c++ - 如何将这样的位图复制到DC?

java - 在圆内的每个像素上运行

python - 如何在 App Engine 中解码 JPG 中的像素(使用纯 python)?

windows - 使用鼠标光标捕获屏幕截图

c - 如何获取bmp中出现频率最高的像素