Wolfram Computation Meets Knowledge

Why does Mathematica 12.1 return different results for ImageDimensions?

Content displayed on computer monitors is often specified in “points,” e.g. a 12-point font for text. Different operating systems and monitors have different standards for how many pixels constitute a given number of points.

Up to Version 12.0, the Mathematica front end assumed that a point was exactly equal to a pixel on every monitor and operating system. This led to inconsistencies with how Mathematica displayed fonts and images compared to other software. Particularly on monitors with high pixel density (HiDPI), Mathematica would appear much smaller in comparison, as Mathematica’s “12-point” font would actually be a 12-pixel font.

Since Version 12.1, Mathematica displays consistently across all operating systems and types of monitors without requiring any adjustments, but points and pixels are no longer the same.

As an example, a graphics expression with the option ImageSize → 100 is now consistently displayed at 100 points on all monitors, which may correspond to 200 pixels on one display, and 100 pixels on another.

The function ImageDimensions returns the actual number of pixels in an image, as opposed to the number of points. Code that is reliant on ImageDimensions may therefore return different results in Mathematica Version 12.1 than in previous versions.

The Wolfram Language contains a wide range of tools that allow users to specify locations in images independently of whether points or pixels are used. For example, the function Scaled uses a system of coordinates that scales to the image. Therefore, Scaled[{1/2,1/2}] refers to the center of an image, and Scaled[{1,1}] refers to the top-right corner of an image.

Further information on the coordinate systems available for graphics and images is available in the documentation.

Is this article helpful?

Any comments?

Thank you for your feedback.


Contact Support

Whether you have a question about billing, activation or something more technical, we are ready to help you.

1-800-WOLFRAM (+1-217-398-0700 for international callers)

Customer Support

8am–5pm US Central Time

  • Product registration or activation
  • Pre-sales information and ordering
  • Help with installation and first launch

Advanced Technical Support (for eligible customers)

8am–5pm US Central Time

8:30–10am & 11am–5pm US Central Time

  • Priority technical support
  • Product assistance from Wolfram experts
  • Help with Wolfram Language programming
  • Advanced installation support