English 中文(简体)
Image rendered with wrong colors in IE8
原标题:

I have a gradient image as a PNG (no transparency) in a web-page. By taking a screenshot of Chrome showing the page and cropping the image from the page, I see the exact same colors are drawn as the image contains... put the screenshot next to the image in Paint and they are identical.

But when I do the same with the page rendered in IE8, the colors are different. I thought initially IE8 must be cropping the edges and stretching it, but this is not the case... IE8 is rendering colors that are not in the original image, like there is a filter on top of the image.

Anyone got any ideas why, and how I can address this? The point is I have a background filled with solid color, and the gradient image is designed to perfectly blend with this... one side of the image is the same RGB value as the page background. Obviously if the image is not drawn right, you see a nasty edge effect.

问题回答

It s only slightly different, right? But enough to see the difference?

That s because PNG files typically store gamma correction information, which was supposed to be a good idea, but actually isn t: The Sad Story of PNG Gamma “Correction”.

The best way to fix it is to remove that gamma information from the PNG, and in fact all other color space-related information. That s all stored in the gAMA, sRGB, cHRM and iCCP chunks.

There are several utilities that can do that, for example Pngcrush and Pngout. There are tons more of these tools around, some with more features than others, and some more user-friendly than others, but you should be able to find those yourself now.

The PNG Gamma Dilemma kind of summarizes that first article, and gives some usage info for Pngcrush.





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签