Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox blurs an image when scaled through external CSS or inline style.

Tags:

When I visually scale an image, Firefox 3 blurs it. Firefox 2 and other browsers don't, which is the behavior I expect. This is especially lame for creating a web based game using png or gif sprites.

For example, when showing a 100x100 image in Firefox 3 like this:

<img src="sprite.gif" width="200" /> 

or

<img src="sprite.gif" style="width:200px; height:200px;" /> 

it looks blurred in FF3, not in IE.

Any ideas on how to prevent this?

like image 745
Martin Kool Avatar asked Dec 23 '08 09:12

Martin Kool


People also ask

How do I Unblur a picture in Firefox?

If you double-click that section or choose Edit as HTML in the context menu, then remove ug-blur-effect and press Return/Enter, the image will unblur right away.

Why are my pictures blurry in HTML?

Simple, the browser is trying to maintain the image aspect ratio based on the original size, resulting in a calculated height with a decimal value which in turn causes pixel compression, hence a blurry image.

Does Firefox sharpen images?

Photos are sharper on web pages in Firefox than Chrome/chromium based browsers.


2 Answers

I discovered this new feature of FireFox:

http://developer.mozilla.org/En/CSS/Image-rendering

So putting this in your CSS will fix it:

image-rendering: -moz-crisp-edges; 

Thought I'd share this info. Sorry for answering my own question ;)

like image 74
Martin Kool Avatar answered Sep 18 '22 14:09

Martin Kool


I was just wondering about this myself, but it seems it's hardcoded in ff3 :( http://forums.mozillazine.org/viewtopic.php?f=7&t=752735&p=5008845

ff2 didn't do any interpolation

IE doesn't by default, but you can turn it on: http://www.joelonsoftware.com/items/2008/12/22.html

like image 27
pixelbeat Avatar answered Sep 18 '22 14:09

pixelbeat