What a machine computes

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.

Worth reading first: A pixel is not a point · The pixel that is not square.

A crop moves the frame and not the camera took a screenshot of a rendered window and cut a rectangle out of it, the rectangle given in the logical pixels an operating system speaks in. A crop scales nothing. It moves the frame’s corner and leaves the renderer’s camera where it was, so a cropped picture is exactly an off-centre camera’s picture, and the only thing the crop adds is the rounding of its edges to whole panel pixels: under half a pixel each way, cycling with the crop’s position.

A crop is rarely the end of the road. It is resized to fit something else: a thumbnail in a list, a figure in a document, an upload limited to a stated width. The tool doing it is given a width and keeps the aspect by computing the height, which comes out fractional and is rounded. The essay ended by asking what that costs. The resize scales the focal length by the target width over the crop’s width across, and by the rounded height over the crop’s height down, and those are two ratios of whole numbers that need not agree. How far apart do the picture’s two focal lengths end up? Is the disagreement bounded by one rounding in the target’s pixels, as every step taken by the true map has been, or does it grow when the target is small? And can a recovery reading the camera from a thumbnail tell the resize’s squeeze from a camera whose pixels were never square?

The disagreement is one rounding of the height, which grows relative to the picture as the picture shrinks. In pixels of focal length it can be several pixels. In the picture itself it moves nothing more than half a pixel. And no recovery from the picture’s own contents comes close to seeing it.

A width is given and a height is rounded

The window is the earlier one: 1280 by 720 logical pixels, a camera with a 60° vertical field, composited at a device scale of 1.5 onto a panel 1920 by 1080. The crop is 211 by 131 logical pixels, a shape chosen to match no common aspect, and lands on 316 by 196 panel pixels when each edge is rounded. Resized to 117 px wide, it should be 72.57 px tall and is 73.

A 211 × 131 crop resized to 117 px wide is 73 px tall, and its two focal lengths differ by 0.59%A 1280 × 720 window shown at a device scale of 1.5, a crop of 211 × 131 logical pixels taken from it (316 × 196 on the panel), and the crop resized to 117 px wide with its height rounded to keep the aspect: 72.57 px rounds to 73. The resize scales the renderer's focal length by 117/316 across and 73/196 down, so the picture's two focal lengths are 346.3 and 348.4 px, 2.05 px apart, 0.59%: a pixel 1.0059 times as tall as it is wide. The slider changes the target width.window, 1280 × 720 logical, at 1.5117 × 73 pxfx 346.3 pxfy 348.4 pxcrop 211 × 131 → 117 wideheight 72.57 → 73
Fig. 1 A 211 × 131 logical crop of a 1280 × 720 window at a device scale of 1.5, and the same crop resized to a stated width with its height rounded, with the two focal lengths the resized picture carries. The slider changes the target width.

The renderer’s focal length on the panel is the same in both directions, and the resize multiplies it by 117/316 across and by 73/196 down. The picture then has two focal lengths, 346.3 px and 348.4 px, 0.59% apart: it is the picture of a camera whose pixels are 1.0059 times as tall as they are wide. The resize also carries the principal point, by the true map that sends a pixel’s centre to a pixel’s centre, so the camera’s centre lands where the earlier essays found the true map always puts it, and the only thing new is the squeeze. The cropped part was already an off-centre camera, the one a tile is an off-centre frustum draws on purpose, and the resize keeps it one.

A rounded viewport has two focal lengths met the same arithmetic one step earlier in the pipeline. A renderer that takes its aspect from a window’s requested size and draws into a buffer of whole device pixels leaves two focal lengths that differ by up to a part in three hundred. That disagreement looked like it should grow on small screens and turned out to be a bounded displacement at the frame’s edge. The resize repeats its shape, but it puts the rounding somewhere the viewport could not: at the end of the pipeline, at a size chosen by whoever wanted the thumbnail, and after a crop that has already decided how much of the scene the picture holds.

One rounding of the height, filled

The rounded height is within half a pixel of the height the aspect asks for, so the two scales disagree by at most half a pixel over that height:

∣fyfx−1∣=∣Hth−1∣≤12h,\left|\frac{f_y}{f_x} - 1\right| = \left|\frac{H_t}{h} - 1\right| \le \frac{1}{2h},

where h=Wt⋅(crop height)/(crop width)h = W_t \cdot (\text{crop height})/(\text{crop width}) is the unrounded target height and HtH_t its rounding.

The two focal lengths disagree by one rounding of the target's height, which grows as the target shrinksThe 211 × 131 logical crop at a device scale of 1.5, resized to every even width from 64 to 800 px with its height rounded (solid) or floored (dashed), and the relative disagreement of the picture's two focal lengths. Rounded, it stays inside ±1/(2h) (dotted), h the unrounded height: ±0.81% at 100 px wide, ±0.10% at 800. At 64 px it is 0.77%, at 320 px −0.24%. Floored, it is never positive and averages −1/(2h), the rounded case's worst, always in the direction that makes the pixel short.-101200400600800target width (px)fy/fx − 1 (%)height roundedheight floored±1/(2h)211 × 131 logical, scale 1.5inside one rounding
Fig. 2 The relative disagreement of the two focal lengths for the 211 × 131 crop resized to every even width from 64 to 800 px, with the height rounded and floored, inside the bound of one rounding.

As the target width runs from 64 to 800 px the disagreement saws back and forth inside that envelope: 0.77% at 64 px wide, −0.24% at 320, never more than 0.81% at 100 px and 0.10% at 800. A tool that floors the height instead of rounding it, which is what integer division does, never makes the picture taller than its aspect, and its disagreement averages −1/(2h)-1/(2h), as large as the rounded case’s worst and always in the direction that makes the pixel short.

That answers the first two questions in the relative sense, and the answer to the second is that it grows. A step by the true map is bounded by one rounding in its own pixels, and here the rounding is of the target’s height, so the smaller the target the larger the share of the picture the half pixel is.

Across every crop size the disagreement fills one rounding of the height and never exceeds itEvery crop from 60 to 900 logical pixels wide and 40 to 600 tall, 10659 sizes at a device scale of 1.5, resized to 320 px wide with the height rounded. For each band of the unrounded target height, the worst disagreement of the two focal lengths (dots), against 1/(2h) (solid). The worst reaches 99.9% of the bound, so the bound is the disagreement's size and not a loose ceiling, and it is set by the target's height alone: a wide strip resized to 320 px across is a few dozen pixels tall and can carry 1% or more, a tall crop at the same width a few hundredths.012200400600800target height before rounding (px)worst |fy/fx − 1| (%)1/(2h)10659 crop sizes → 320 px wideworst 99.9% of one rounding
Fig. 3 Every crop from 60 to 900 logical pixels wide and 40 to 600 tall resized to 320 px wide: the worst disagreement at each unrounded target height, against one rounding.

Across 10,659 crop sizes resized to 320 px wide, the worst disagreement in each band of target heights reaches 99.9% of 1/(2h)1/(2h), so the bound is not a ceiling that the arithmetic rarely nears but the disagreement’s size. It is set by the target’s height alone. A strip resized to 320 px across, a panoramic slice of a game’s horizon or a toolbar, is a few dozen pixels tall and carries a disagreement of 1% or more. A tall crop at the same width carries a few hundredths. What the tool is asked for, a width, says nothing about which of those the picture will be.

Half a pixel of height is pixels of focal length

A relative disagreement is a percentage of the focal length, and the focal length of a crop is not a percentage of anything the crop shows.

In pixels the disagreement is half a pixel times the crop's focal length in heights, so a narrow crop carries pixels of itThe same resize for three crops of the window, the disagreement of the two focal lengths in the target's own pixels against the target width (thin), and its bound, half a pixel times fx/h (thick): about 0.6 px for the 900 × 560 crop, 2.4 px for the 211 × 131 crop and 6.6 px for the 61 × 47 crop, whatever the target. The largest gaps reached are 0.54, 2.36 and 6.30 px. A crop that takes a small part of the window has a long focal length for its height, and half a pixel of height is that many pixels of focal length.0246200400600800target width (px)|fy − fx| (target px)900 × 560 crop211 × 131 crop61 × 47 cropthick: half a pixel × f/hnarrow crop: up to 6.3 px
Fig. 4 The disagreement of the two focal lengths in the target’s own pixels, for three crops of the window, against the target width, with its bound, half a pixel times the crop’s focal length in heights.

Multiplying the relative bound by the focal length gives the gap in the target’s pixels: half a pixel times fx/hf_x/h, the focal length measured in the picture’s own heights. That ratio does not depend on the target width at all, because resizing scales the focal length and the height together. It depends only on how much of the window the crop takes. A crop of 900 by 560 logical pixels, most of the window, has a focal length of about 1.2 of its heights and carries at most 0.6 px of focal gap at any target. The 211 by 131 crop, at 4.8 heights, carries up to 2.4 px. A crop of 61 by 47, a detail cut from the middle of the frame, has a focal length of more than thirteen of its own heights and carries up to 6.6 px: reached at 6.3 px across the widths tried.

So the second question has a second answer. In focal length, the disagreement is bounded by one rounding times the crop’s narrowness, which no choice of target can change. A thumbnail of a detail can carry a focal length several pixels different in its two directions, and the crop decided that before the resize was asked for.

The picture moves by half a pixel

What a reader of the picture cares about is not the focal length but where the picture puts things, and there the narrow crop’s six pixels vanish.

In the picture the resize moves no edge more than half a pixel, and the crop's own rounding is carried at the resize's scaleFor the same three crops, the largest distance at the picture's corners and edge midpoints between where the resized picture puts a direction and where the request means it to be. The resize's own share, measured against the crop as it landed (dotted), never exceeds 0.494 px for any crop or target: one rounding of a row, half a pixel at most. The whole error (solid) adds the crop's own rounding on the panel, at most half a panel pixel, carried at the resize's scale: shrunk in a thumbnail and grown in an enlargement, 5.73 px when the 61 × 47 crop is blown up to 800 px, 8.7 times its panel size.0246200400600800target width (px)largest error at the picture's edge (px)900 × 560 crop211 × 131 crop61 × 47 cropdotted: the resize's own sharegrid line: half a pixel
Fig. 5 For the same three crops, the largest error at the picture’s corners and edge midpoints: the resize’s own share, measured against the crop as it landed, and the whole error, which adds the crop’s own rounding on the panel carried at the resize’s scale.

Measured against the crop as it landed on the panel, scaled by the width alone, the resize moves no corner or edge midpoint of the picture by more than 0.494 px, for any of the three crops at any target width. That is one rounding of a row: the bottom edge of the picture is where the rounded height puts it, which is within half a pixel of where the aspect would, and every other row is moved less. The six pixels of focal gap on the narrow crop are spread across thirteen heights of focal length, and over the picture’s own height they are half a pixel. A narrow field’s focal length is poorly pinned by its own picture for exactly that reason, and the resize spoils it only where nothing was pinned.

The whole error, against the camera the original request means, adds the crop’s own rounding. That is at most half a panel pixel at each edge, and the resize carries it at its own scale. In a thumbnail the scale is below one and the crop’s rounding shrinks; the 211 by 131 crop at 117 px wide is within 0.41 px everywhere. In an enlargement it grows. The 61 by 47 crop blown up to 800 px wide, 8.7 times its panel size, is 5.7 px wrong at its edge, almost all of it the crop’s half pixel on the panel magnified, and the resize’s own share is still under half a pixel. A rounding is bounded in the pixels it happens in, and an enlargement makes those pixels large.

So the second question’s full answer: the resize’s own rounding is bounded by half a pixel in the target, whatever the target’s size, as every true-map step has been. What grows is everything that happened before it, carried at the resize’s scale.

Can the thumbnail say it was squeezed?

The resized picture is exactly the picture of a camera with non-square pixels, of squeeze Ht/hH_t/h, and a principal point where the true map put it. Nothing in it can distinguish the two, because they are the same picture. The pixel that is not square found that a recovery has to be told the pixel’s shape, and a box leaves a line of cameras found why: a box’s three right angles are satisfied by a whole family of cameras of different squeezes. What closes the family is a fourth right angle the box does not contain, and a square closes the line of cameras supplied it from the diagonals of a square on one face.

So the third question is really whether that reading is fine enough to see a resize’s squeeze, and the answer turns on comparing two quantities that both depend on the thumbnail’s size.

A box and a square read the squeeze far less well than a resize can spoil it, at every size of thumbnailThe spread with which a box and a square inside the picture give back the pixel's squeeze, from lines read to 0.5 px (solid) and to 0.1 px (dotted) of the picture's own pixels, against the picture's width, and the largest disagreement a resize to that width can leave in a picture of the same 690 × 420 shape (thick). At 690 px the reading's spread is 1.4% against a worst resize of 0.12%; at 320 px, 4.7% against 0.26%; at 160 px, 19% against 0.51%. Even lines read to a tenth of a pixel spread twice the worst resize, 0.24% at 690 px. Read to half a pixel, the spread grows faster than the resize's worst as the picture shrinks; read to a tenth, the two shrink together and the reading stays about twice too coarse.0.10.31310200400600width of the picture the box is read in (px)squeeze, read spread or worst resize (%)read to 0.5 pxread to 0.1 pxworst resizebox and square, spread over 400 readsthe reading never reaches the resize
Fig. 6 The spread with which a box and a square read the pixel’s squeeze inside pictures 160 to 690 px wide, from lines read to 0.5 px and to 0.1 px of the picture’s own pixels, against the largest squeeze a resize to that width can leave.

Read to half a pixel in a picture 690 px wide, a box and a square give the squeeze back with a spread of 1.4%, against a worst resize of 0.12%. At 320 px the spread is 4.7% against 0.26%; at 160 px, 19% against 0.51%. Shrinking the thumbnail raises both, and raises the reading’s spread faster, because the vanishing points it rests on are found from lines whose pixels are getting large against their length. Read to a tenth of a pixel, which a careful edge fit on a sharp picture can reach, the reading’s spread falls to 0.24% at 690 px and 1.1% at 160 px: the two then shrink together, and the reading stays about twice as coarse as the worst squeeze it would need to see.

The answer is no, at every size, for one picture. A collection is different in one case. A rounded height errs as often one way as the other, so readings pooled over many thumbnails average its squeeze away along with their own scatter. A floored height errs one way only, by 1/(2h)1/(2h) on average, and pooling does not remove a bias. If a hundred floored thumbnails 160 px wide were read to a tenth of a pixel and their readings were independent, the spread of their mean would fall by a factor of ten, to about 0.11%, under the 0.5% the flooring leaves. That is the arithmetic of pooling, not a measurement made here, and it needs a hundred pictures of boxes and squares that a tool made the same way, but it is the one route by which a resize’s squeeze could show up in the pictures themselves.

So for a single thumbnail the squeeze is invisible. The squeeze a resize gives a picture is real, it is up to a percent on a small thumbnail, and it is never as large as the uncertainty of reading it from the picture. A recovery from a thumbnail that is told the pixels are square is wrong by at most one rounding of the height, which is under its own error bars; told nothing, it cannot find out.

What a resized crop carries

Taken together, the pipeline from a renderer to a thumbnail has acquired three small things, and they are worth keeping apart because they come from different steps and behave differently.

The crop moves the principal point by its own rounding, under half a panel pixel, a point the centre of the picture is not the centre of the paper found any reader of a camera has to locate rather than assume, and a resize carries that at its scale. The resize squeezes the pixel by one rounding of the target’s height, at most 1/(2h)1/(2h), and moves the picture’s edge by under half a target pixel. And the focal length’s gap in pixels is that squeeze times the crop’s narrowness, which is the step where a detail cut from the middle of a frame pays more than a whole screenshot does.

None of them is visible in the picture, and only the last is large in pixels. For anyone reading a camera back from a resized crop, the practical rule is short. Take the focal length from the width, which the tool was asked for and did not round. Treat the height’s focal length as the width’s, which is wrong by at most one rounding and right to well within the reading’s own error. And if the picture has been enlarged, expect the crop’s own half pixel to come back at the enlargement’s scale, because the resize cannot know where it came from.

The window, the crop and the tool, as assumed

The resize uses the true map. A tool that multiplies coordinates by the scale instead moves the centre by (s−1)/2(s-1)/2 of a new pixel, as halving a picture moves its centre found, and that offset is added to everything here without changing the squeeze.

The height is rounded or floored from the width. Some tools fit a picture inside a box and round whichever side is not given, and some round both from a scale factor. Every one of them rounds one or both sides once, and the bound is one rounding of whichever side was rounded; a tool that rounds both can disagree by the sum of two half-pixel shares.

The crop’s edges are rounded on the panel, the conversion the earlier essay found most common. A tool that converts the crop’s corner as though it were a pixel’s centre adds a further (d−1)/2(d-1)/2 of a panel pixel, which an enlargement also carries.

The recovery reads a box and a square in a picture of the reading’s standard shape, 690 by 420, scaled down. A recovery from many boxes, or from a calibration target, reads the squeeze more finely, and one could in principle see a large thumbnail’s squeeze; one from a single box in a small thumbnail cannot.

Still open: whether a chain of resizes adds its roundings or forgets them

A picture on the web is rarely resized once. A crop becomes a figure at one width, the figure is placed in a page that scales it by a device’s ratio, and a second tool makes a preview card from the page. Each resize rounds a height, and the true-map steps on a display were found by a display’s scales cancel, if they are true maps to telescope: each rounding undone by the next scale, so that only the last survived. Those steps were all of the whole frame and all chosen to undo one another. A chain of thumbnails is chosen by people who do not know about each other’s roundings.

The measurement that settles what the chain does carries a crop through two and three resizes to stated widths, each rounding its own height, and asks whether the final squeeze is bounded by the last step’s rounding, as on a display, or by the sum of every step’s, and whether a chain that enlarges between two reductions brings the crop’s own half pixel back at the largest scale it passed through rather than the last.

A chain of resizes remembers its smallest picture takes that measurement: each tool keeps the aspect of the picture it was handed, so every rounding is kept, the squeeze is bounded by the sum of the steps’ roundings and dominated by the smallest picture’s, and the crop’s own half pixel comes back only at the final scale, since true maps compose.

A crop resized to a stated width, its height rounded, has two focal lengths that disagree by at most one rounding of that height, and across every crop size the disagreement fills the bound. In pixels of focal length that is half a pixel times the crop’s focal length in heights, so a narrow crop carries several; in the picture no edge moves more than half a pixel, and the crop’s own rounding is carried at the resize’s scale. A box and a square read the squeeze far more coarsely than any resize can spoil it, at every size of thumbnail.

What links here

Computed from the collection, not written here: the essays that point at this one.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

Aspect ratioFocal lengthIdentifiabilityPrincipal pointQuantisation