Match edges vs. match centers

Suppose you have an 3×1 pixel image, and you enlarge it to make a 9×1 pixel image...

The match edges model

Most image resizing software uses a model where, if the pixels are thought of as rectangles, the outer edges of the outermost pixels of the target image are aligned with the outer edges of the outermost pixels of the source image:

The match centers model

However, some image resizing software does it a different way, and aligns the centers of the outermost pixels:

Example

We’ll resize this 3×3 image: (enlarged: ) to 100×100 pixels.

Resized by an application that uses the match edges model
(ImageMagick)
Resized by an application that uses the match centers model
(IrfanView v4.30)

Discussion

The match edges model is, in my opinion, more sane. It’s more compatible with how most computer software actually uses images. Resizing an image from M pixels to N pixels changes the size of the image features by a factor of exactly N/M.

The match centers model avoids the need to extrapolate sample values that are outside of any of the existing samples. It may make some sense in the school of thought that says a pixel is a point sample, not a little rectangle. Resizing an image from M pixels to N pixels changes the size of the image features by a factor of (N–1)/(M–1), which is nonintuitive. Doubling the number of pixels, for example, does not exactly double the size of the objects in the image.

Match centers may be slightly easier to program, though you probably need special-case code for single-pixel images. But then, according to this model, single-pixel images don’t really even exist, since they have zero size.

If you’re evaluating or comparing image resizing software, you’ll have to figure out which model each application uses. Be aware that some carelessly-written software doesn’t consistently use the same model in all situations. It’s also unfortunately common to use neither model correctly, and have weird off-by-one or off-by-one-half errors, etc.

If you’re writing an image resizing algorithm, just be aware that these models are not equivalent, and that you must consciously decide which one to use.

ImageWorsener always uses the match edges model, though match centers can be done by calculating the right parameters to use with the -translate and -imagesize options.

Also possibly of interest: ResampleScope.