gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 23:03:47 27 4
gpt4 key购买 nike

有时我将 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com