简体   繁体   中英

Optimising Images for Internet Explorer

On a site of mine, my client is reporting that images that are reduced in size by code (ie specified a width/height) are appearing jagged and pixellated. I have asked her what browser she uses and inevitably it's Internet Explorer.

Is there a way to optimise images in IE or do I need to manually resize the images on photoshop before I put them on the site?

The images in question are resized from 220x220 to 80x80 and I have javascript that expands them to 220x220 upon clicking.

Resizing down or up in a browser can look terrible. It varies from browser to browser, but apparently IE is the worst .

It's best to either write a server side script to create thumbnails, or to manually do it yourself if quality of the image is important. It also saves bandwidth as you don't need to load the big image and only display 1/10th of the pixels.

You should avoid using width and height for resizing. It'll cause a longer loading time (on slow connections and big images).

A better idea is making thumbnails (with Photoshop for example) and use the "Web save" option to reduce the size even more.

http://acidmartin.wordpress.com/2009/01/05/better-image-scaling-and-resampling-in-internet-explorer/

Bicubic image resampling is turned off by default in IE. You can use this to turn it on in your reset stylesheet:

img
{
-ms-interpolation-mode: bicubic;
}

use timthumb, it will create thumbnails for you, you just need to link to the script, and specify the size of the thumbnail and that's it. http://www.darrenhoyt.com/2008/04/02/timthumb-php-script-released/

i'm using it on one of my sites -> http://iv-designs.org/ you can see the images are clean and not pixelated.

Assuming your images are JPEGs, the easiest option is to use IE7's bicubic image resizing feature, which you can turn on using CSS:

img { -ms-interpolation-mode: bicubic; }

Be aware that it's got performance implications (using it a lot will slow the browser down). It also has no effect in IE6, and is no longer needed in IE8.

Another way (which does work in IE6) is to use Ethan Marcotte's wonderful Fluid Images script , which uses some damn clever CSS filters to fix the problem in IE6 and 7. My own variation on the theme fixes the right click problem, but requires jQuery.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM