How to measure length from a photo with a known scale
If you're wondering how to measure length from a photo of a shelf, look for two marks a known distance apart. A ruler lying flat on the shelf gives you a way to turn pixels into inches or centimeters.
Can you use the photo you already have?
Look at the edge you want to measure. Are both ends visible? Is there something of known size at the same height? A ruler on the shelf works for the top of the shelf. A ruler on the floor below it looks smaller because it's farther from the camera.
Without a known scale, even a sharp close-up can't tell you the real length. NASA ran into this when photographing hail damage on a shuttle tank. "However, since there was no reference object in the image, the engineers could not determine the scale of the damage." NASA's account of the tank photos
If you can take another picture, lay the ruler alongside the edge. Hold the camera directly above the surface and keep the back of the phone parallel to it. A tilted view makes the far end look smaller than the near end.
How to measure the length of something in a picture
- Measure a span you know. Open the picture in an image editor with a straight-line measuring tool. Washington State University's instructions say to "make a line along the edge of the ruler" when setting the scale. Start and finish on two tick marks you can read. WSU's illustrated ImageJ guide
- Measure the edge in the same picture. Draw a second line from one end of the shelf to the other. Read both line lengths in pixels using the same tool.
- Convert to the ruler's units. Divide the shelf's pixel length by the ruler span's pixel length. Multiply by the real distance between those two tick marks.
| Line | In the photo | On the shelf |
|---|---|---|
| Ruler span | 200 pixels | 5 cm |
| Shelf edge | 480 pixels | About 12 cm |
In this example, 480 divided by 200 is 2.4. The shelf edge is 2.4 times the 5 cm span, or about 12 cm. If it's hard to tell which pixel marks the end, try placing the line again and see how much the estimate changes.
Using a bank card with Sprindis
I built Sprindis to do the scaling when you take a new picture in its camera. Lay a standard bank card flat on the surface. Its long edge is 85.60 mm. Keep all four corners in view. Once the app recognizes the card, tap one end of the edge to freeze the picture, then tap the other end on that picture.
Sprindis gives the length with a range in centimeters or inches. It can ask you to try again if the view is too dark or the card is too slanted. If the two endpoints sit at different heights, the card can't serve as a ruler for both.


What was not checked
In a bench check, an Honor Pad X7 camera measured lines displayed on a second tablet. On all 11 test images, the known length fell inside the app's range. In a separate check with the release app, a line known to be 4.33 inches long gave a reading of 4.3 inches and a range of 4.3 to 4.4 inches.
Those checks used flat test images. I have no field study showing how closely the ranges match a tape on household furniture. I also have no measurement from a live test on a phone using Google's augmented reality service.