What are the image formats that can be displayed on a web browser? What are some formats that cannot be used on a w开发者_如何学Pythoneb page? which format is best suited to display each of the following and why:
A colour photograph on a web page; A two-colour navigation button.besides the nice link in the comment for Website Image Formats: Choosing the right format for the right task
many people don't know about 8-bit PNG, which is usually better than GIF in size... there are tools to minimize the size of PNG, such as PNGOUT: http://en.wikipedia.org/wiki/PNGOUT
note that PNG won't support animation like GIF does. 8 bit PNG only has binary transparency but not alpha transparency... if you google for 8-bit PNG, PNG8 or PNG/8, there will be lots of info.
PNG is better for compressing graphics, whereas JPG is more commonly used for compressing photographs. Beware of the fact that JPG is using destructive compression, i.e. if you are trying to exhibit a high quality, high resolution photograph, and you turn it into JPG, its quality will suffer. There is a trade-off between the degree of JPG image degradation and the size saving, which you can control in your conversion software.
Since nobody has answered this part of the question... Some formats that cannot be used on a web page (most browsers won't display them) include TIFF and JPG2000 (wavelet encoded). For more details on which formats are supported by browsers, see this wikipedia page.
Use:
GIF for animations
JPG for photos
PNG for everything else.
Usually JPEG, GIF and PNG
JPEGSs are better for photos because it will usually be much smaller than the equiv quality GIF, while a GIF logo will usually look better and have a smaller file size than in JPEG format
PNG can support both JPEG and GIF styles and has more transparency features but older browsers won't support it.
精彩评论