Please explain the discrepancy of my physical resolution and what javascript tells me.

1    21 May 2017 00:59 by u/vastrightwing

I'm trying to put together a simple web page for a Samsung Galaxy Tab A (SM T280). I asked my graphic designer to give me a WXGA (1280 x 800) background image. This is what Samsung detailed in their screen specifications. Darn! The graphic is way too large! I asked javascript to tell me what it thinks the screen resolution is and it reports 960 x 600. OK, I resize the image to that, yes, that fits nicely now.

So who is lying? Samsung or Javascript? I put Firefox in full screen mode, so there are no borders. I went into the setup of the device and there is no alternate screen resolution to choose from. Is there some CSS or command to change the screen resolution? I mean this tablet sucks in terms of resolution without downgrading further to 960 x 600. I suspect there is some kind of scaling occurring. So how do I display images in native resolution?

Thank you!

5 comments

2

Something to do with CSS pixel widths maybe?

1

Interesting. So browser developers decided it is better to scale images to some arbitrary reference size rather than keep the native resolution. And then it never occurred to them to allow anyone to view the image without the scaling. I can't find a way to unscale the image. It's a shame because some devices have really nice high resolution displays.

2

I think that's only partly correct. An image won't be scaled twice First down to the simulated CSS screen, then up to the display screen. It probably only scales once from the image to the size of the final composite.

To avoid this you would need to set the DPI to be the usual desktop DPI (72 or 96). Then it should be a 1:1.

0

I was wondering about that myself.

2

The brilliant people who do website design and who write the CSS standard and who write browsers decided that 1 pixel in the browser does not mean 1 pixel on the screen all because they are too brilliant to not represent every text size in pixels. /u/tame has provided you with a suitable link.