Формат PNG должен быть форматом без потерь, но при сохранении изображения в виде PNG-файла вам предлагается выбрать уровень сжатия. Означает ли это, что формат PNG на самом деле не без потерь? Сегодняшний постпользовательский пост SuperUser помогает устранить путаницу для любопытного читателя.
Сегодняшняя сессия вопросов и ответов приходит к нам благодаря SuperUser - подразделению Stack Exchange, основанной на сообществах сайтам Q & A.
Вопрос
Считыватель SuperUser 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?
Есть ли разница в качестве изображения в зависимости от выбранного вами уровня сжатия?
Ответ
У участников SuperUser LordNeckbeard и jjlin есть ответ для нас. Сначала, LordNeckbeard:
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
Image
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
Image
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 smaller 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.
Есть что добавить к объяснению? Отключить звук в комментариях. Хотите узнать больше ответов от других пользователей Windows? Посмотрите здесь полную дискуссионную тему.
Есть несколько вещей, таких как разочарование, как прослушивание вашей любимой музыки и внезапное воспроизведение одной или нескольких песен на более низком уровне. Есть ли простой способ исправить проблему с объемом, не жертвуя качеством? Сегодняшний пост и пост-пост SuperUser помогает разочарованному читателю решить его проблемы с объемом.
Если вы когда-либо заглядывали в диспетчер задач во время работы с Google Chrome, возможно, вы были удивлены, увидев, что количество записей chrome.exe радикально превысило количество реальных окон Chrome, которые вы открыли. Что такое сделка со всеми этими процессами?
Пришло время сжать некоторые файлы, и какой формат вы используете? Zip, RAR, 7z или что-то еще? Мы выполнили некоторые тесты, чтобы определить, какой формат дает максимальное сжатие.
Если вы хотите уменьшить размер изображения без потери качества, ознакомьтесь с этими бесплатными инструментами для сжатия изображения в Интернете. Вы можете сжимать jpeg или png изображение с помощью этого программного обеспечения для сжатия изображений онлайн.