90
$\begingroup$

If you calculate the area of a rectangle, you just multiply the height and the width and get back the unit squared. Example: 5cm * 10cm = 50cm²

In contrast, if you calculate the size of an image, you also multiply the height and the width, but you get back the unit - Pixel - just as it was the unit of the height and width before multiplying. Example: What you actually calculate is the following: 3840 Pixel * 2160 Pixel = 8294400 Pixel

What I would expect is: 3840 Pixel * 2160 Pixel = 8294400 Pixel²

Why is that the unit at multiplying Pixels is not being squared?

$\endgroup$
3
  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$
    – D.W.
    Commented Feb 14, 2018 at 17:27
  • 1
    $\begingroup$ @JLRishe Please don't post answers as comments, especially when the point you're raising has already been covered by the existing answers. The question was protected precisely to prevent this kind of repetition. $\endgroup$ Commented Feb 19, 2018 at 17:01
  • $\begingroup$ The answer depends on the definition; Wikipedia gives several. It is however fairly clear which is meant here. It is also more a question about conventions of usage than about logical necessity. $\endgroup$
    – PJTraill
    Commented Mar 21, 2022 at 9:57

11 Answers 11

7
$\begingroup$

The width of an image is being measured in a discrete 2 dimensional space.

The image is 3840 pixels across. This means there is a horizontal band of 3840 pixels (which are each 2 dimensional regions) that cross the space. We aren't using pixel as a unit of measurement -- we are actually counting things called pixels.

When we measure how tall it is, we measure 2160 pixels in a vertical band to the top of the image. Again, pixel isn't a unit of measurement, it is a thing we are counting.

If you take a grid of things that is 3840 wide and 2160 tall, you end up with 3840*2160 of them. This is counting.

We could also describe the image as 3840 pixel_widths wide and 2160 pixel_heights tall, and modify those distances. Then we'd get 3840*2160 (pixel_width * pixel_height) area. This is an area calculation.

These happen to have the same numerical value because pixel_width*pixel_height = pixel_area, and X pixels have an area of X pixel_area.

A difference between these calculations appears when you have non-square pixels and you rotate. Something 10 pixel_widths wide rotated 90 degrees may not be 10 pixel_heights tall. At the same time, the rotation should preserve area (up to rounding).

The ratio between width and height on a pixel is called its aspect ratio. CRTs often had an effective aspect ratio of 1.11 if I remember correctly.

$\endgroup$
239
$\begingroup$

Because "pixel" isn't a unit of measurement: it's an object. So, just like a wall that's 30 bricks wide by 10 bricks tall contains 300 bricks (not bricks-squared), an image that's 30 pixels wide by 10 pixels tall contains 300 pixels (not pixels-squared).

$\endgroup$
18
  • 19
    $\begingroup$ “pixel” is actually often used as, and interchangeable with, other units of measurement. The most prominent example being in CSS. Dimensional analysis plays no role in these applications but if it did, we’d probably indeed (have to) use pixel². $\endgroup$ Commented Feb 13, 2018 at 18:38
  • 15
    $\begingroup$ pixel is already an measure of an area (like acre or football field). It is defined by the smallest controllable area of a display. This area is small on a monitor and can be large on a billboard. Assume a pixel is 2mm wide and 1mm high -> pixel=2mm^2 A screen 800x600 is 800*2mm*600*1mm 960000mm^2 but always 460000 pixel $\endgroup$ Commented Feb 14, 2018 at 7:49
  • 8
    $\begingroup$ I'd say it's not a one-dimensional unit of measurement. Every object can be used as unit of measurement for a quantity in its own dimension, or lower. Pixels are two-dimensional, so we can use it to count out areas (but also lengths, by abbreviating "as long as the sides of 1080 pixels"). $\endgroup$
    – Raphael
    Commented Feb 14, 2018 at 10:13
  • 20
    $\begingroup$ The London Bus is also a popular unit of width, height, length, and volume, but no-one would ever speak of a cubic Bus. $\endgroup$ Commented Feb 14, 2018 at 22:03
  • 4
    $\begingroup$ @MichaelKay Weight, rather than volume. Volume is measured in Olympic swimming pools. :-P $\endgroup$ Commented Feb 14, 2018 at 22:10
122
$\begingroup$

I have a different answer from other folks: pixel is the correct unit for areas, and you do need dimensional analysis. The discrepancy is that the pixel in "3840 pixels wide" is not the same unit as the pixel in "the display has 8294400 pixels". Instead, "pixel" is a natural-language abbreviation for different units at different times, and it takes some context and judgment to expand the abbreviation appropriately.

The unabbreviated form is "3840 pixel-widths wide x 2160 pixel-heights tall = a bazillion pixel-areas" (and one "pixel area" is definitionally equal to "pixel-width * pixel-height" for rectangular pixels).

N.B. it is frequently assumed that pixel width and pixel height are equal (as in the CSS discussion in the other answer), and even without that assumption the above assumes that pixels are rectangular -- and these assumptions are often but not always true!

$\endgroup$
25
  • 18
    $\begingroup$ In fact the unit of width and height is √pixel, multiplying together gives you pixels :o) $\endgroup$ Commented Feb 13, 2018 at 19:47
  • 27
    $\begingroup$ @WillCrawford You have fallen into the assumption that pixels are square! Or else you don't want the square root. =) $\endgroup$ Commented Feb 13, 2018 at 20:46
  • 18
    $\begingroup$ Pixels aren't a distance or an area per se. They're discrete objects. $\endgroup$ Commented Feb 14, 2018 at 15:24
  • 5
    $\begingroup$ Too bad this is so heavily upvoted when it's simply wrong. A pixel is a single, unresolvable, element of a sampled image. No more, no less. The fact that pixels when realized physically, such as LCD elements or CRT colorbars, have an area, or an equivalent image solid angle, is secondary. When a display is K*J pixels, the entire display has that many pixels, but you do not (yet) know anything about its physical dimensions. (yeah, yeah, images are 2-dimensional, so pixels must have two dimensions unless you're into Peano Curves) $\endgroup$ Commented Feb 14, 2018 at 18:49
  • 6
    $\begingroup$ @CarlWitthoft I'm not sure I understand which part of my proposed answer you're disagreeing with, exactly. It is common for there to be varying conversion factors between units; e.g. if I have $100, how many euros do I have? Dunno until I go to exchange them -- could be different today and tomorrow. Same with pixel dimensions and physical dimensions: it's true that I don't know how many square inches a pixel is, but it is still sensible to talk about how many pixels I have. And anyway no part of this answer discusses physical dimensions, so what conflict has been set up by your statements? $\endgroup$ Commented Feb 14, 2018 at 18:54
44
$\begingroup$

A pixel is already a two-dimensional object

In your example, you specify centimeters as a contrasting example. Centimeters are a unit of length, which is by nature a one-dimensional measurement. When measuring areas, we need to talk about square centimeters, which defines the unit as a two-dimensional quadrilateral with right angles and equal length sides = 1cm. When discussing volume we then talk about cubic centimeters, which defines the unit as a three-dimensional, six sided prism with squares for sides, the length of each side = 1cm.

Since a pixel is an abstract concept, and not a strict unit of measure, it makes sense for it to exist purely as a two-dimensional object. When you're measuring something like screen resolution, you could consider the measurement to include an implied pixel widths. ex: 1920 pixel widths x 1280 pixel widths

As an interesting note, there is a three-dimensional pixel, called a voxel, which is defined as a three-dimensional prism with a pixel for each face.

@KlaymenDK Had a great note, which is that pixels are so abstract and context sensitive that they are not necessarily square. This pushes their class further from 'unit of measure' and into 'count of objects' territory.

$\endgroup$
5
  • 12
    $\begingroup$ I really think this is the authoritative answer: pixels are two-dimensional. Note also that, historically and currently, pixels are not always square - or even identical on a unit level (for instance, PenTile displays muddle what a single pixel really is). $\endgroup$
    – KlaymenDK
    Commented Feb 14, 2018 at 11:17
  • 2
    $\begingroup$ pixels are not an "abstract concept", they are a physical object. Centimeters and other units of measure are the abstract concept. $\endgroup$ Commented Feb 15, 2018 at 12:39
  • 3
    $\begingroup$ @StephenOstermiller this is incorrect. Centimeters have a fixed physical definition as 1/100th of a meter. A meter is defined as the length of the path travelled by light in a vacuum in 1/299,792,458th of a second. Originally it was meant to represent 1/10,000th of the distance between the north pole and the equator but this was difficult to gauge. By contrast, the pixels on my current screen are of both a different size AND shape as the pixels on my phone. Software interprets them, and hardware renders them to a local environment. Centimeters are a physical standard, pixels are abstract. $\endgroup$ Commented Feb 15, 2018 at 17:18
  • 3
    $\begingroup$ "Physical" mean something that is actually there that you can see. It doesn't mean "standard". It would be more accurate to say "Since pixels vary in size, and are not a strict unit of measure..." $\endgroup$ Commented Feb 15, 2018 at 17:51
  • 3
    $\begingroup$ @StephenOstermiller This is an issue of semantics. A software developer would often interpret a pixel as being more abstract than a centimeter because the measurement of one is known, while the other varies based on device. The correct use of verbiage here will vary depending on the individual's perspective, and I wrote the answer from my own. $\endgroup$ Commented Feb 15, 2018 at 18:34
16
$\begingroup$

As others have said it's because pixel is an object. If you'd like to think of it in terms of units, the equation is technically 3840 pixel-heights * 2160 pixel-widths = 8294400 pixels (where you can think of a pixel as 1 pixel-height * 1 pixel-width)

$\endgroup$
2
  • 5
    $\begingroup$ I think the 'brick wall' analogy is best - nobody uses K*J bricks^2 to build a wall:-) $\endgroup$ Commented Feb 14, 2018 at 18:46
  • $\begingroup$ @CarlWitthoft that's true, and I agree that analogy is better, but if someone is set on thinking in terms of units, it's helpful to realize that "10 pixels high" is really shorthand for something like 10*(1 pixel-height) $\endgroup$
    – reffu
    Commented Feb 14, 2018 at 19:27
12
$\begingroup$

Pixels are weakly typed units. Just like 1 can be coerced into an integer, floating-point value, or string in a weakly typed language, a "pixel" is coerced into whatever unit makes sense in context.

If we were to more strongly type the unit, we'd probably have several:

  1. pixel-width;

  2. pixel-height;

  3. pixel-diagonal; and

  4. pixel-area.

As you correctly point out, if we assume that pixels are squares, then$$ \left[\text{pixel-area}\right] = {\left[\text{pixel-side}\right]}^2, $$such that it'd make more sense to speak of square-pixels when discussing image size in terms of pixel-sides.

The thing's just that, if we're talking image size, then a "pixel" is meant to be coerced into a pixel-area, not a pixel-side.

Note: Pixels are units

A unit is literally anything we use to express measurements of some sort. Sure pixels are objects, but so are other units - there's no conflict there. For example, in the US, we still measure lengths in feet.

Object-defined units of measurement were the historical norm, so there's nothing unusual about pixels being object-defined units. Just, there're obvious shortcomings to such definitions, so in recent history standardization efforts have been made. For example, feet are now more formally defined than as a person's foot's length.

That said, the same is happening to the pixel unit:

A device-independent pixel (also: density-independent pixel, dip, dp) is a physical unit of measurement based on a coordinate system held by a computer and represents an abstraction of a pixel for use by an application that an underlying system then converts to physical pixels.

-"Device-independent pixel", Wikipedia

$\endgroup$
4
  • 1
    $\begingroup$ But the foot (as used for linear measurement) isn’t an object! It’s defined to be some fraction of a meter and the meter is defined in terms of the wavelength of light. In Britain, the foot has been officially defined with respect to a reference bar for over a thousand years, and anything based lengths of actual feet has been just a local approximation; likewise, the ancient Greeks defined the foot independently of actual feet. $\endgroup$ Commented Feb 14, 2018 at 11:57
  • 1
    $\begingroup$ @DavidRicherby They've been redefined in terms of of the speed of light in a vacuum (the wavelength of light varies, e.g. blue light has a different wavelength than red light), but the original definitions were just use-based. Folks needed to express lengths long before modern standardization, so things could be expressed in terms of body parts, paces, common objects like barley grains (to grab a random definition of "inch" from Wikipedia), etc.. Measurement units and counting objects aren't separate concepts; the notion of "length" itself is basically a concatenation of things. $\endgroup$
    – Nat
    Commented Feb 14, 2018 at 12:46
  • $\begingroup$ @DavidRicherby Hah I checked Wikipedia; you're right, they did define a "meter" in terms of a particular type of light's wavelength from 1960 to 1983! Actually kinda fun to read up on the history of this stuff. $\endgroup$
    – Nat
    Commented Feb 14, 2018 at 13:01
  • $\begingroup$ Well, actually, I was mistakenly referring to the current definition! I was confusing it with the second, which is defined as a fixed number of cycles of a specific frequency of light. Anyway, the general point stands: the meter is defined in terms of some property of light. $\endgroup$ Commented Feb 14, 2018 at 13:14
6
$\begingroup$

You may want to look at this in another way:

$$3840\, \frac{\mathrm{px}}{\mathrm{scanline}}\times2160\, \mathrm{scanline}=8294400\,\mathrm{px}.$$

I.e. treat pixels as two-dimensional objects, much like bricks in a wall, and just count them along the display width and height.

$\endgroup$
3
  • $\begingroup$ What new insight does this answer add that hasn't already been said? Multiple answers already noted that pixels are individual objects, most often already of dimension 2. $\endgroup$
    – Discrete lizard
    Commented Feb 15, 2018 at 8:14
  • 4
    $\begingroup$ Simple: it adds scanline as a unit which still plays nicely with dimensional analysis. $\endgroup$
    – Ruslan
    Commented Feb 15, 2018 at 9:11
  • $\begingroup$ I thought the scanline bit added new, relevant and useful information. This makes much more sense to me than the brick wall analogy. $\endgroup$ Commented Feb 16, 2018 at 1:58
4
$\begingroup$

A pixel on a screen is like a block in your city. You don't say I love the houses on this city block² since block is by definition itself the square, not the side of the square.

$\endgroup$
3
$\begingroup$

Pixel are a discrete unit you want to know the count of. Practically, it is like counting potatoes in several bags. Use the other length as plain number, so eg. 1600*900 Pixels, but not 1600 Pixels*900 Pixels. Leaving one number without unit yields Pixels as expected (instead of Pixels-squared) and is mathematically correct.

$\endgroup$
0
1
$\begingroup$

Technically a pixel is not a unit of measurement. In optical design pixels are measured in radians. In photogrammetry, particularly when performing interior orientation, pixels are measured in millimeters. For example, if you have a sensor with 5micron pixels and you talk about a line of pixels 1000 wide, those pixels are not 5mm wide by 1mm or 0mm tall. They are 0.005mm tall. Pixels are inherently 2 dimensional, sort of. When you include tonal information pixels are actually 3 dimensional. 4th, 5th, or 6th dimensional pixels are, of course, voxels. Within the realm of hyperstacks, each nth dimension is defined and can decompose into into its constituent pixels across any dimensionality.

To think about this more concretely (pun intended) if you have a cinder block wall and the blocks are 9x18 inches then a 10x10 block wall will be 90x180 inches or 10 blocks wide and 10 blocks tall. I suppose that if you had a 1000x1000 block wall you could say that you had a megablock but then there would need to be a base2 / base10 debate.

Bottom line, those pixel dimensions might be convenient integers when stored in an image file but in the real world a single pixel can have any number of dimensions greater than 2 and have sizes of any precision.

$\endgroup$
-1
$\begingroup$

It happens when you multiply units. Pixel is not a unit. You can do that with Pixel per Inch etc. but not with the pixel alone.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.