Understand the relationship
The reasoning behind the result
The label and bar are joined by an axis scale
L = Ps
L is the physical length represented by the bar, P is its span in final-image pixels, and s is physical length per pixel along that bar's axis. Dividing any two appropriate quantities recovers the third. All physical quantities use the same selected unit.
A recovered scale is only as trustworthy as the existing label and endpoint measurement. It applies along that axis in that image state; it does not validate a label that was already wrong or establish the other axis after nonuniform resizing.
Resizing and cropping affect different quantities
For a resize of the same field by output/input ratio R, physical length per pixel becomes s/R. A bar resized together with the image retains its physical meaning when its label is unchanged and its pixels are scaled consistently. A bar copied independently or pasted from another scale can become incorrect.
Cropping shortens the available image extent without changing pixel spacing. The extent input therefore describes the final image, while the scale must already account for any resizing. Pixel calibration and image dimensions are kept separate.
Whole-pixel rendering introduces a measurable difference
Pr = round(P); Lr = Prs; ΔL = Lr − L
An ideal physical label can require a fractional pixel span. An editor may support subpixel or vector placement; if a whole-pixel bar is desired instead, nearest, lower and upper integer spans are displayed with the actual physical length each would represent.
The shown difference compares that actual length with the original physical label. It is an annotation rounding difference, not an estimate of calibration uncertainty. A nearest span of zero is explicitly retained as a collapsed bar; the calculator does not silently stretch it to one pixel.
Geometric extent does not decide a readable layout
Axis occupancy = 100P/Nimage
Nimage is final image width for a horizontal bar or final height for a vertical bar. The occupancy percentage compares their lengths on the same axis. A bar longer than that extent cannot fit entirely along that axis inside the image.
An equal or shorter span still needs room for margins, a label and the chosen position. Contrast, font size, obstruction of specimen detail and publication layout are not measured here. The diagram uses one common length scale and shows any overrun without clipping it.
Follow the numbers
A fractional-pixel target and its annotation alternatives
- At 0.3 µm/pixel, a 10 µm label requires 10/0.3 = 33.333333 pixels.
- The nearest whole span is 33 pixels, representing 33 × 0.3 = 9.9 µm. Keeping the 10 µm label would leave a −0.1 µm or −1% length difference.
- A 34-pixel bar represents 10.2 µm, a +0.2 µm or +2% difference from the requested label.
- In a 500-pixel image axis, the ideal span occupies 6.666667% of the extent, before allowing for margins or text.
Use supported fractional placement, adjust the chosen physical label or explicitly account for the selected integer span; the calculator does not choose a hidden correction.
Quick guide
How to use this calculator
- Choose whether you know the physical label, pixel span or both. Use an independently valid label when recovering calibration from an existing bar.
- Select the bar orientation and use the final image's corresponding axis scale. A horizontal calibration cannot determine an unknown vertical scale.
- Enter the image width or height along that axis. Read the ideal span, whole-pixel alternatives and geometric extent comparison.
- Draw or revise the bar in your image editor and verify the final saved image's scale. This calculator does not edit or upload an image.
Calculation method
Calculation and interpretation
Make the physical label, pixel span and image calibration agree before an annotation is drawn.
P = L/s; L = Ps; s = L/P; Lrounded = round(P)s; relative label difference = (Lrounded/L − 1) × 100%.
Worked example
A fractional-pixel target and its annotation alternatives
Use supported fractional placement, adjust the chosen physical label or explicitly account for the selected integer span; the calculator does not choose a hidden correction.
P = L/s; L = Ps; s = L/P; Lrounded = round(P)s; relative label difference = (Lrounded/L − 1) × 100%.
Supported inputs
Precision and limits
No image or label validation
This is local annotation arithmetic. No image is loaded, edited or analyzed; the calibration, endpoint convention and existing label must be established independently.
One axis at a time
Use the matching final-axis scale. Anisotropic resizing, distortion or shear cannot be corrected by borrowing another axis's calibration. Positive dimension, scale and magnification inputs support 10⁻¹² through 10¹² in their selected units. Signed displacement components may be exactly zero; nonzero components must have an absolute magnitude from 10⁻¹² through 10¹². These are numerical bounds, not equipment specifications or accuracy claims.
Continue calculating
Related calculators