Viewport — the series
-
A pixel is not a point
Where the sample sits inside a pixel is a convention, and getting it wrong shifts every mark by half a pixel in each axis. What that costs can be measured by recovering the camera from the picture — the answer is a principal point exactly 0.707 px from the truth with the focal length untouched, and the other half-pixel mistake does precisely the reverse.
-
Halving a picture moves its centre by a quarter of a pixel
Multiply a principal point by the scale of a resize and it comes out wrong by (s − 1)/2 of a new pixel, at any point and for every reduction. At a pyramid's fourth level that is nearly half a pixel, turning a recovered pose by half a degree. The picture, asked, reports the true map.
-
A rounded viewport has two focal lengths
Compute the aspect ratio from a window's requested size and draw into a buffer of whole device pixels, and the picture has two focal lengths that differ by up to one part in three hundred. It looks like a defect that should grow worse on small screens and better on large ones. At the frame's edge it does neither, because the error is a bounded displacement of a fraction of a pixel on any window at all.
-
A display's scales cancel, if they are true maps
Between a renderer's buffer and a screenshot there may be two more resamples: a compositor reducing a whole-number scale to the panel, and a screenshot read back at the window's size. Each rounds to whole pixels, and under the true map the roundings telescope: only the last size and the renderer's assumed aspect matter, so the one-rounding bound survives, and a screenshot at the window's size shows the square camera exactly. A naive step breaks the bound in six per cent of windows and moves every centre.
-
A crop moves the frame and not the camera
A crop of a screenshot scales nothing. It moves the frame's corner and leaves the renderer's principal point where it was, so the cropped picture is exactly the picture of an off-centre camera and nothing in it can say otherwise. What the crop adds is the rounding of its edges to whole screen pixels, which moves the principal point by at most half a pixel each way, in a pattern that repeats with the crop's position and never grows. Converting the crop's corner with the map that is right for a pixel's centre adds half the scale's excess on top, a whole pixel on a display at 2 or 3.
-
A thumbnail gives its camera a pixel it cannot see
A crop resized to a stated width has its height rounded, so its two focal lengths are scaled by two different ratios of whole numbers. They disagree by at most one rounding of the target's height, 1/(2h): 0.8% at 100 px wide, 0.1% at 800, and across ten thousand crop sizes the worst fills the bound. In the target's own pixels that is half a pixel times the crop's focal length in heights, six pixels for a narrow crop, while no corner of the picture moves more than half a pixel. A box and a square in the same thumbnail read the squeeze ten to forty times too coarsely to notice.
-
A chain of resizes remembers its smallest picture
A picture resized several times, each tool keeping the aspect of the picture it was handed, carries every tool's rounding to the end: nothing undoes an earlier one, because the next tool rounds the aspect it was given. The final squeeze is bounded by the sum of every step's one rounding and fills it, so the smallest picture in the chain dominates, and an enlargement after a thumbnail brings the thumbnail's half pixel back magnified: 14 px of height at 690 px wide through a 25 px icon. The roundings add as a root of the count, floors add in a straight line, and a tool that keeps the source's own aspect forgets them all but its last.