views:

55

answers:

1

Here is the PNG file and what it looks like in a QWebView when accessed via http://sstatic.net/so/img/logo.png:

When accessed via HTTP:

<img src="http://sstatic.net/so/img/logo.png" width='250' height='61' />


When accessed via a resource:

<img src="qrc:/images/logo.png" width='250' height='61' />


As you can see, the only modification was the src attribute of the image tag... why the drop in quality?

Edit: The file is being shrunk via width: and height: in the style attribute, if that makes a difference. I updated the code.

+1  A: 

The 2nd image is being resized from 300x83 to 250x61. The original image is anti-aliased, the anti-aliasing pixels are getting lost in the resizing operation. That affects the perceived image quality badly. This image will only look good if it is shown with its original size. An image editor that uses a high-quality bi-cubic filter might do a better job, not so sure.

Hans Passant
Yes... but the images are being resized in both cases. The difference is where they are being loaded from.
George Edison
Not when I look at them with Firebug, the 1st image is not getting resized, it comes from the server in the display size. There are possibly two resizings on the 2nd image, one when you posted it to the server, another when my browser resized it. Can't tell.
Hans Passant
@Hans: Sorry, the first image is not being resized because the markup for StackOverflow doesn't let me change it. In the app, however, it really is resized and looks like that one. (Only smaller, of course.)
George Edison