What to do with an annoyingly large PNG background?
8 Bits »

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
The way it's meant to be

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: What to do with an annoyingly large PNG background?
« Reply #1, on December 22nd, 2010, 01:02 PM »
Try saving it as a JPG and see whether that generates any nasty image artefacts.

As for resizing, not if done as a background-image as far as I know. That said, you could try dropping it into an image, forcing size in the attributes (which causes rescaling, rather than using CSS width/height which crops), then positioning it fixed, top/left 0, with a z-index lower than anything else.
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: What to do with an annoyingly large PNG background?
« Reply #3, on December 22nd, 2010, 01:24 PM »
Oh... in which case the only viable way is to have it requested via JS, where it's sending the user's width/height in the requesting URL and resize it on the fly in PHP or similar, if you're looking for truly closest.

Or have several images pre-sized, requesting the image from 'nearest'.


Background-size, while cool, doesn't work in IE yet to the best of my knowledge, which means you still need to find an alternative solution for the biggest userbase.

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: What to do with an annoyingly large PNG background?
« Reply #4, on December 22nd, 2010, 01:34 PM »
Quote from Arantor on December 22nd, 2010, 01:24 PM
Oh... in which case the only viable way is to have it requested via JS, where it's sending the user's width/height in the requesting URL and resize it on the fly in PHP or similar, if you're looking for truly closest.

Or have several images pre-sized, requesting the image from 'nearest'.


Background-size, while cool, doesn't work in IE yet to the best of my knowledge, which means you still need to find an alternative solution for the biggest userbase.
Thanks for the JPG suggestion.
Saving it as a JPG in 50 as quality made it 20KB without any visible quality loss. lol....
And I didn't know background-size is a CSS3 property until now, glad I don't use it much :P.

Nao

  • Dadman with a boy
  • Posts: 16,082