PNG image question? [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
开发者_Python百科 Improve this questionIn a PNG image, what is the difference between interlace vs none? In what case would I want to use 'interlace' and in what cased would i want to use 'none'. How does it differ from a JPG, is the quality better in PNG?
Quality
JPEG quality is never "better" than PNG, as PNGs are compressed without loss of any information. If you edit and save a PNG a hundred times, the quality will stay the same.
JPEG images on the other side lose information when you compress them. Editing and saving a JPG file more than once will reduce the quality drastically, to some point where it's noticeable.
JPEG vs PNG
One uses JPEG for photographs because it compresses them without noticeable quality loss. PNGs can be used for photographs too, but the compression rate will never be as good. PNGs work better for simple graphics and line art. JPEGs however should never be used for this purpose, as ringing artefacts can appear (see image)
Interlacing
Interlacing is introduced so that when a PNG file is transmitted, a lower-resolution preview can be seen, even if the whole image isn't transferred yet.
Interlace was once used to display a low-resolution version of the image back when modems were really slow. The low-res version would be shown while the high-res one was loading.
No need to use it in these modern times.
JPG is good at compressing photographs. Things with lots of tones and colours.
PNG/GIF is very good at compressing line-art. Things with big blocks of the same colour.
If you use JPG on line art you sometimes see fuzzy distortions around the edges of blocks of colours, which is why you should avoid JPG for artwork.
PNG also allows for images without background which is usefull for web designs
"Interlaced" PNG images have their pixels stored in a complicated order that enables a coarse approximation to the whole image to be displayed when only some of the pixels have been seen. If you're sending images across a really slow network connection then you might conceivably want to use this feature, though it depends on whatever's on the receiving end actually being able to take advantage. Otherwise, don't do it.
PNGs are compressed losslessly: the image displayed is exactly the image that was fed into whatever generated the PNG. JPEGs are compressed lossily: the image displayed will not be identical. For some sorts of image -- for instance, most photographs -- the effect of the lossy compression is scarcely detectable by eye even when a great deal of compression has been applied. For some other sorts -- for instance, text or line art -- the effect is likely to be very obvious and very unpleasant. Images where sharp colour/brightness transitions are adjacent to very smooth regions are likely to look very bad when stored as JPEGs.
精彩评论