PNG格式應該是無損格式,但是當您將影象儲存為PNG檔案時,會要求您選擇壓縮級別。這是否意味著PNG格式實際上並不是無損的?今天的超級使用者問答有助於澄清好奇讀者的困惑。
今天的問答環節是由SuperUser提供的,SuperUser是Stack Exchange的一個分支,是一個由社群驅動的問答網站分組。
超級使用者讀者pkout想知道PNG影象的質量是否受所選壓縮級別的影響:
As I understand it, PNG files use lossless compression. However, when I am using an image editor such as Gimp and try to save an image as a PNG file, it asks for a compression level ranging between 0 and 9.
If it has a compression parameter that affects the visual precision of the compressed image, how is PNG lossless then? Can someone please explain this to me? Do I get lossless behavior only when I set the compression level to 9?
根據您選擇的壓縮級別,影象質量是否有差異?
超級使用者貢獻者LordNeckbeard和jjlin為我們提供了答案。首先,領主:
PNG is Compressed, but Lossless
The compression level is a trade-off between file size and encoding/decoding speed. To overly generalize, even non-image formats such as FLAC have similar concepts.
Different Compression Levels, Same Decoded Output
Although the file sizes are different due the the different compression levels, the actual decoded output will be identical. You can compare the MD5 hashes of the decoded outputs with ffmpeg using the MD5 muxer. This is best shown with some examples.
Create PNG Files
Compare File Size
Decode the PNG Files and Show MD5 Hashes
Since both hashes are the same, you can be assured that the decoded outputs (the uncompressed raw files) are exactly the same.
接著是jjlin的回答:
PNG is lossless. GIMP is most likely not using the best choice of wording in this case.
Think of it as quality of compression or level of compression. With lower compression, you get a bigger file, but it takes less time to produce, whereas with higher compression, you get a **aller file that takes longer to produce.
Typically you get diminishing returns, i.e. not as much decrease in size compared to the increase in time it takes when going up to the highest compression levels, but it is up to you.
有什麼要補充的解釋嗎?在評論中發出聲音。想從其他精通技術的Stack Exchange使用者那裡瞭解更多答案嗎?在這裡檢視完整的討論主題。
...中的幾個字母?這些是副檔名,用於定義檔案另存為哪種格式。一種型別的檔案很少有單一的格式,因此您可能會對它們的不同之處以及最好使用哪種格式感到困惑。 ...
...?事實證明,這不是那麼直觀。Photoshop允許使用多種檔案格式和引數,每種格式和引數都有各自的優點。有時,以特定檔案格式儲存影象可能會降低工作質量。以下是一個指南,可以確保您以儘可能高的質量儲存影象。 ...
...或WMA呢?為什麼有這麼多的音訊標準?有沒有最好的音訊格式?哪些是重要的,哪些是可以忽略的? ...
...象中的文字和掃描檔案中的惡意軟體,到將PDF轉換為其他格式和解鎖受密碼保護的PDF,您可以找到完美的PDF工具來幫助您。 ...
...不必要的資訊位來減小檔案大小。它在影象、影片和音訊格式中最為常見,在這些格式中,源媒體的完美表示是不必要的。這類媒體的許多常見格式都使用有失真壓縮;MP3和JPEG是兩個流行的例子。 ...
...與iTunes和iOS相容,因此您可以在不更改例程的情況下更改格式。 ...
並非所有的影象檔案格式都是相同的。事實上,它們中的許多都是為了解決現有格式無法解決的問題而建立的。例如,JPEG的出現是因為影象檔案的大小佔用了太多的儲存空間。 ...
帶有.webp副檔名的檔案是由Google開發的一種檔案格式,它可以在不犧牲儲存空間質量的情況下減小影象的大小。WebP圖片的設計目的是讓網路更快,有更小、更豐富的照片供開發者使用。 相關:什麼是副檔名? 什麼是webp檔案(a ...
...背景上保持其原始外觀。我們將介紹幾種將影象轉換為PNG格式的方法。 什麼是png檔案(a png file)? PNG,或行動式網路圖形,是一種流行的影象格式,用於網際網路圖形的能力,以支援瀏覽器的透明度。它最早是在20世紀90年代作為...
具有.wav或.wave副檔名的檔案是波形音訊檔案格式。它是一個以段儲存資料的容器音訊檔案。它是由微軟和IBM建立的,已經成為標準的PC音訊檔案格式。 注意:WAVE和WAV檔案(或.WAV和.WAVE副檔名)是相同的。在本文中,我們將把它...