W3C home > Mailing lists > Public > www-style@w3.org > October 2009

Re: [css3-background] Preparing for Last Call

From: Bert Bos <bert@w3.org>
Date: Wed, 7 Oct 2009 18:15:41 +0200
To: "www-style@w3.org" <www-style@w3.org>
Message-Id: <200910071815.41948.bert@w3.org>
On Wednesday 07 October 2009, Brad Kemper wrote:
> On Oct 6, 2009, at 10:49 AM, Bert Bos <bert@w3.org> wrote:
> > A more general problem is that the latest text can cause images to
> > be scaled up as well as down, and that may not be optimal for
> > raster images. The worst case is an image whose width is just above
> > 50% of the
> > background positioning area. It will be scaled to almost twice its
> > size.
> >
> > The worst case of the previous version is an image that is almost
> > 100% wide: it will be reduced to almost half its size. However, it
> > is likely
> > that a (raster) image scaled down to half its size looks better
> > than one scaled to double its size, at least assuming a scaling
> > algorithm that interpolates pixels rather than drops them.
>
> There is no worse case for 'background-size' values of 'contain' or
> 'cover', or 'border-image-repeat' of 'stretch'. For those, raster
> images can be stretched to thousands of times bigger than intrinsic.
> So as an author, whether using those or using 'round', I would need
> to edit the image or edit the CSS (reducing the background
> positioning area, for instance) to try to prevent that, if I found it
> objectionable. But I actually don't so much (find it objectionable),
> except perhaps in that very extreme case. In the tests I did with two
> or more tiles in border-image, I found the upscaling to be much
> preferable to the increased distortion of downscaling everything.

I found that JPEG images can rarely be scaled up. The compression 
artifacts (in particular pixels that seem to have "leaked" from nearby 
differently colored areas) are not noticeable at the normal size, but 
become very visible when the size increases. The result invariably 
looks blurred as well.

On the other hand, for images that are meant to be tiled, you would 
typically use PNG. Those artifacts don't occur in PNG (unless the PNG 
has been a JPEG before...), but the blurry look is the same.

Of course, as the support for SVG improves and spreads to more CSS 
implementations, many of the images won't even be PNG, but will be 
replaced by SVG images and scaling won't be a problem anymore.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Wednesday, 7 October 2009 16:16:12 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:21 GMT