Over the last week or so, I’ve been working on the redesign for this site. One small part of the redesign includes some
NG: images to which I’ve given a specific solid background color. These images are then placed inside some code on a page to which the exact same background color is applied via :CSS:. So, the image should blend in perfectly with the background since they both have the same color and PNG is a lossless format, meaning that there’s no worry of pixelation or other types of degredation that might occur with, say, a JPG image used in this situation.
As I said, the image and background should match perfectly. And they do; in FireFox and even, a bit surprisingly, in :IE:. Where they don’t work—again, surprisingly—is in Safari. With Safari, the background color of the PNG image and the CSS color don’t match.
It turns out, this is due to gamma correction. Or, specifically, due to Safari trying to do gamma correction and not doing a particularly good job at it. I found this article that gives a much, much better explanation than I ever could. According to that article and a number of other resources I was able to find after some extensive Google searching, it doesn’t look like there’s a solution to the problem. Well, aside from “don’t use PNG images”, that is.
The problem, though, is that I need to use PNG images. You see, the images I’m using are being dynamically created by a script I’ll hopefully be releasing soon. It creates images in the PNG format because 1) the GIF format is still under patent protection in some parts of the world and PHP support for it is thus a bit spotty and 2) JPG images wouldn’t work because of the previously-mentioned pixelation/degredation issues.
So, it looks like you Safari users will just have to live with images that don’t match the rest of the background color because your browser is broken in this regard. Don’t worry, at least you’re better off than Opera users, since that browser is currently choking even worse due to the XHTML-compliant way I’m passing values in a URL (i.e. using “filen.php?var1=val1&var2=val2” instead of “filen.php?var1=val1&var2=val2"). Go figure that it would choke on the correct way and work with the invalid way. [shrug]
Posted Tuesday January 4, 2005
in Web Development by Chris Curtis
This is an older entry and as such, it may be by a guest author or contain formatting problems / extraneous code. If you notice something wrong with the entry, please use the Contact page to let me know the entry title and issue.
thanks for this useful bit of web dev knowledge Chris. I’ve filed it away.
Anychance we get a sneak peak of the redesign?
By les on January 4, 2005 at 08:20pm link