Pixel is a unit of length and area

When measuring the size of a two-dimensional digital picture, the unit pixel is used in a weird overloaded way. Sometimes, it is used as a unit of linear length. For example, each frame of an animation is 1920 pixels wide and 1080 pixels tall. The Cascading Style Sheets (CSS) web standard has px
as a unit of length alongside mm
, pt
, etc. Image editor programs like Adobe Photoshop show each dimension of an image as an integer followed by the unit of pixel.
Other times, the pixel is used as a unit of area – e.g. a camera sensor has 12 megapixels (or 12 000 000 pixels). Graphics processing units (GPUs) have some aspects of their performance quoted in gigapixels per second, and these refer to square pixels that can be placed anywhere in a 2D image, not a measure of linear size.
Viewed mathematically through the lens of dimensional analysis, these two conflicting definitions lead to illogical nonsense. Given that the formula for the area of a rectangle is area = width × height, if for example we have width = 1920 pixel and height = 1080 pixel, then we get area = 2 073 600 pixel2. That’s right, multiplying two linear dimensions – where each has the unit pixel – produces an area with the unit square pixel. This is analogous to how metres and square metres behave.
On the other hand, if we trust the colloquial definitions of how pixels are used in practice, then an image that is 20 pixels wide and 30 pixels tall has an area of 600 pixels, so 20 pixel × 30 pixel = 600 pixel2 = 600 pixel, then pixel2 = pixel, and finally pixel = 1. That would mean the pixel is a dimensionless unit that is just another name for 1, kind of like how the radian is length divided by length so it also equals one, and the steradian is area divided by area which also equals one.
I don’t think there is a clean way to resolve this particular tension between pure mathematics and colloquialisms. One imperfect approach is to define a pixel to be a square whose physical size depends on the exact device or standard under consideration, and then give the name pixel-side to the linear unit that defines both the width and height of the pixel. Under this approach, we can also call the pixel-side as a square-root-pixel or √pixel (this is not unheard of as engineering uses √Hz (square root hertz) in places). We will have to ignore less common cases such as non-square pixels (this was used in images/
The other awkward approach is to insist that the pixel is a unit of length, and then we need to refer to all instances of area as square pixels – for example, a television monitor might have 8 million square pixels. Following metric rules, prefixes can only be applied to units and not to the result of computations – e.g. 1 million square metres is not 1 mega-square-metre, but is 1 square kilometre. So everything that was previously quantified in megapixels would now need to be written out as a big number (e.g. 8 million square pixels) or more awkwardly switch to square kilopixels, which squares both the prefix and the unit simultaneously. But in this case, prefixes have no effect in languages like Chinese and Japanese because pixel counts are already reported using native words for big numbers (e.g. 8 million pixels is 800萬像素).
Overall, this isn’t a particularly serious discussion because the pixel isn’t a metric unit and it rarely participates in compound units and calculations more complicated than something like “pixels per metre” or “gigapixels per second”. But it does highlight that the common terminology is imperfect and breaks the regularity that scientists come to expect when working with physical units in calculations. (Outside of computing, an example of tension in the definitions of units is that the pound is conflated as both a unit of mass and force. Meanwhile, the metric system mandates a clean separation between the kilogram and the newton.)