png格式是無損的,因為它有一個壓縮引數?

PNG格式應該是無損格式,但是當您將影象儲存為PNG檔案時,會要求您選擇壓縮級別。這是否意味著PNG格式實際上並不是無損的?今天的超級使用者問答有助於澄清好奇讀者的困惑。...

png格式是無損的,因為它有一個壓縮引數?

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

007Ys3FFgy1gpfa02i1nmj30hd01ndft

  • By default, ffmpeg will use -compression_level 100 for PNG output.
  • A quick, sloppy test showed that 100 (the highest compression level) took roughly three times longer to encode and five times longer to decode than 0 (the lowest compression level) in this example.

Compare File Size

007Ys3FFgy1gpfa02ywvrj30hd029q2s

Decode the PNG Files and Show MD5 Hashes

007Ys3FFgy1gpfa03ggvpj30hd03ijrh

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使用者那裡瞭解更多答案嗎?在這裡檢視完整的討論主題。

  • 發表於 2021-04-11 03:50
  • 閱讀 ( 49 )
  • 分類:網際網路

你可能感興趣的文章

知道何時使用哪種檔案格式:png與jpg、doc與pdf、mp3與flac

...中的幾個字母?這些是副檔名,用於定義檔案另存為哪種格式。一種型別的檔案很少有單一的格式,因此您可能會對它們的不同之處以及最好使用哪種格式感到困惑。 ...

  • 發佈於 2021-03-14 05:40
  • 閲讀 ( 47 )

介紹瞭如何在photoshop中儲存高質量的影象

...?事實證明,這不是那麼直觀。Photoshop允許使用多種檔案格式和引數,每種格式和引數都有各自的優點。有時,以特定檔案格式儲存影象可能會降低工作質量。以下是一個指南,可以確保您以儘可能高的質量儲存影象。 ...

  • 發佈於 2021-03-17 01:54
  • 閲讀 ( 43 )

10種最常見的音訊格式:您應該使用哪種格式?

...或WMA呢?為什麼有這麼多的音訊標準?有沒有最好的音訊格式?哪些是重要的,哪些是可以忽略的? ...

  • 發佈於 2021-03-18 07:52
  • 閲讀 ( 49 )

如何壓縮pdf檔案,減小檔案大小,並使其變小

...象中的文字和掃描檔案中的惡意軟體,到將PDF轉換為其他格式和解鎖受密碼保護的PDF,您可以找到完美的PDF工具來幫助您。 ...

  • 發佈於 2021-03-18 08:43
  • 閲讀 ( 56 )

檔案壓縮是如何工作的?

...不必要的資訊位來減小檔案大小。它在影象、影片和音訊格式中最為常見,在這些格式中,源媒體的完美表示是不必要的。這類媒體的許多常見格式都使用有失真壓縮;MP3和JPEG是兩個流行的例子。 ...

  • 發佈於 2021-03-20 02:33
  • 閲讀 ( 49 )

alac vs flac:最適合在mac和ios上聽無損音樂

...與iTunes和iOS相容,因此您可以在不更改例程的情況下更改格式。 ...

  • 發佈於 2021-03-26 13:21
  • 閲讀 ( 46 )

jpg與jpeg:這些影象檔案格式之間有什麼區別?

並非所有的影象檔案格式都是相同的。事實上,它們中的許多都是為了解決現有格式無法解決的問題而建立的。例如,JPEG的出現是因為影象檔案的大小佔用了太多的儲存空間。 ...

  • 發佈於 2021-03-26 15:54
  • 閲讀 ( 57 )

什麼是webp檔案(如何開啟檔案)?

帶有.webp副檔名的檔案是由Google開發的一種檔案格式,它可以在不犧牲儲存空間質量的情況下減小影象的大小。WebP圖片的設計目的是讓網路更快,有更小、更豐富的照片供開發者使用。 相關:什麼是副檔名? 什麼是webp檔案(a ...

  • 發佈於 2021-04-03 11:13
  • 閲讀 ( 40 )

如何將影象轉換為png格式

...背景上保持其原始外觀。我們將介紹幾種將影象轉換為PNG格式的方法。 什麼是png檔案(a png file)? PNG,或行動式網路圖形,是一種流行的影象格式,用於網際網路圖形的能力,以支援瀏覽器的透明度。它最早是在20世紀90年代作為...

  • 發佈於 2021-04-03 20:21
  • 閲讀 ( 35 )

什麼是wav和wave檔案(如何開啟它們)?

具有.wav或.wave副檔名的檔案是波形音訊檔案格式。它是一個以段儲存資料的容器音訊檔案。它是由微軟和IBM建立的,已經成為標準的PC音訊檔案格式。 注意:WAVE和WAV檔案(或.WAV和.WAVE副檔名)是相同的。在本文中,我們將把它...

  • 發佈於 2021-04-04 07:07
  • 閲讀 ( 40 )
蒯人八頑炒tor
蒯人八頑炒tor

0 篇文章

作家榜

  1. admin 0 文章
  2. 孫小欽 0 文章
  3. JVhby0 0 文章
  4. fvpvzrr 0 文章
  5. 0sus8kksc 0 文章
  6. zsfn1903 0 文章
  7. w91395898 0 文章
  8. SuperQueen123 0 文章

相關推薦