3

This is my use case:

I have a web page with a responsive design. The page is vertically split in two halves, on the right hand side I want to show an image (a PDF page rendered as PNG or JPG). The size of the image should change as soon as the window is resized.

I thought I already solved this. I render the image on the server to be big enough for the biggest possible window size (according to our company setup). Chrome and Firefox scale down (and interpolate) the image just fine.

But then there is Internet Explorer 10: If the image size is scaled down to anything beneath 100% it looks like a million flies randomly covering the image ... I cannot seem to find a solution for this.

I learned that in the ol' days (IE7) there used to be a CSS rule for this called -ms-interpolation-mode that could be set to bicubic. But this has been declared obsolete and is not available in IE9+

Do I have to accept it like that? How can this setting be called obsolete if there is no interpolation for scaled images in IE9+? Is there any solution for this?

I know: Usually you don't let your browser scale your images. But do you have a better solution for this use case?

EDIT: I should have mentioned that the images in question are black text on white background. The effect is better visible when using thin lined fonts in the image.

EDIT2: Please recheck the fiddle (http://jsfiddle.net/7grxut1t/16/) before you close this thread. If you resize to a very small size in Chrome and IE you will see the difference!

The relevant part of my code

<div>
   <img src="http://websocket.bplaced.net/test.png"/>
</div>

CSS:

div {
   position: relative;
   width: 50%;
   height: 100%;
}

img {
   width: 100%;
}
Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
devnull69
  • 16,402
  • 8
  • 50
  • 61
  • I have tested this issue with the following [fiddle](http://jsfiddle.net/7grxut1t/1/) but can't reproduce the problem. Everything looks perfectly fine on IE9-11. Voting to close, unless details are added such as screenshots and/or code and image samples. – Bram Vanroy Sep 15 '15 at 20:40
  • see my latest Edit. I edited your fiddle to include a png that very closely matches my use cases. And you will be able to see the effect in IE – devnull69 Sep 15 '15 at 21:01
  • I've [looked](http://stackoverflow.com/q/9945363/464709) [around](http://stackoverflow.com/q/22285959/464709) and it seems we're out of luck. The general consensus is that resized images will look awful on IE9+ and you should perform the resize operation yourself server-side. Voted to reopen anyway -- someone may have another solution to this problem. – Frédéric Hamidi Sep 16 '15 at 06:13

1 Answers1

1

Ok, I found a quite dirty, yet applicable workaround

The angular service from https://gist.github.com/fisch0920/37bac5e741eaec60e983 uses the canvas element to interpolate the image on-the-fly. It works for me in IE10 (I am not sure about IE9- though).

Its method imageService.resizeStep is amazingly fast in IE ... it renders noticeably faster than the native Firefox image interpolation rendering.

I don't really like it, but it works and it doesn't even slow down the user's workflow.

devnull69
  • 16,402
  • 8
  • 50
  • 61