Want to measure an object on your computer screen? Linux has a ScreenRuler to measure in pixels, centimeters, inches, picas, points, and percentage.
It is a free and open-source tool to measure objects either vertically or horizontally. By right-clicking on the ruler, you can easily do:
- Set always on top.
- Rotate the ruler.
- Choose between 6 different metrics.
- And change the font, color, PPI in settings.
With the tool, you can open multiple rulers on your screen. And it allows to drag to move the ruler, or drag the ruler ends to resize it. Which can also be done via Arrow / Alt+Arrow keyboard keys. There’s a “Track mode” allows to read accurate value on ruler by moving your mouse cursor.
If you’re going to measure a real world object with the on screen ruler, you need to change PPI in settings. PPI stands for pixels per inch. The value relies on your display size and screen resolution.
How to Tell/Calculate PPI / DPI in Linux:
Besides searching PPI calculator on the web, you can find out or calculate the value in Linux by yourself.
DPI stands for dots per inch. The DPI value is equal to PPI value.
Option 1. One command to get DPI.
You can run this command in a terminal window to get the DPI in X (may). ScreenRuler uses the value out-of-the-box. However, the value may be incorrect!
xdpyinfo | grep -B 2 resolution
Option 2. Calculate PPI/DPI in Linux
To calculate the screen DPI manually, you need the display size: width x height, and screen solution. You can get them easily by running command in terminal (only for Xorg):
xrandr | grep -w connected
In my case, it’s 309mm x 173mm display with 1366×768 screen resolution. And convert to inches:
- width x height: 309mm x 173mm = 30.9cm x 17.3cm = 30.9/2.54 inch x 17.3/2.54 inch = 12.17inch x 6.81inch
- screen resolution: 1366 x 768
Finally, you can calculate the DPI/PPI via:
- x-resolution / width: 1366 / 12.17 = ~ 112
- y-resolution / height: 768 / 6.81 = ~ 113
Set the value in ScreenRuler settings page and enjoy!
How to Install Screen Ruler in Linux:
Firstly, open terminal from system app launcher:
Next, select run command to install the tool from the official Linux repository:
For Ubuntu, Debian, Linux Mint based systems, run command:
sudo apt install screenruler
Fedora and based systems can install it via command:
sudo dnf install screenruler
That’s all. Enjoy!