VibeScaler · User Guide

Calibrating your microscope & adding scale bars

A printed pattern, a few photos, and a measured pixel size — everything you need to estimate the size of the objects on your microscopy images.

VibeScaler turns an ordinary printed pattern into a calibration standard. You photograph the pattern through your microscope, the app measures how many pixels correspond to a known real-world distance, and from then on it can draw a scale bar onto any image taken with that same camera and setup.

It is built for hobbyist and educational microscopy. It is accurate enough for most amateur work, but it is not a traceable scientific instrument, so the scale bars it places are labelled as approximate — for example, “~100 µm”.

Download

VibeScaler is free and runs on Windows and macOS. It needs no installation — download the file for your system and run it.

Windows (64-bit) — 93 MB macOS (Apple Silicon) — 75.7 MB

On an Intel Mac, run the Apple Silicon build through Rosetta 2. Both macOS builds require macOS 11 (Big Sur) or later.

System requirements

VibeScaler needs no installation: Python and every library it uses are bundled into the application. The application can run straight from any folder — including a USB stick or an external drive.

Note on first time launch:

Windows — The first time you run VibeScaler, Windows may say it doesn't recognize the app. That is normal. Click "More info", then "Run anyway".

macOS — The first time you open VibeScaler, macOS may say it can't be verified. That is normal. Click "Done", then open System Settings → Privacy & Security, scroll to the bottom, and click "Open Anyway".

WindowsWindows 10 or 11 (64-bit). Previous Windows versions are not supported
macOSmacOS 11 (Big Sur) or later — Apple Silicon natively; Intel via Rosetta 2
Size93 MB (Windows) and 75.7 MB (macOS)
CameraAny microscope camera (even your phone's one!) that saves still images
Image formatsJPEG, PNG, TIFF, and BMP

Windows 8, 8.1, and 7 are not supported: Qt 6, the toolkit VibeScaler is built on, requires Windows 10 (version 1607) or newer.

Step-by-step

You calibrate once for a given camera and zoom, then add scale bars to as many images as you like (one by one).

The main window

Launch VibeScaler by double-clicking its icon. The main window offers five choices:

Quick start — a short overview of the whole process. Print pattern — opens the calibration pattern as a PDF to print. Calibrate… — measures the pixel scale from your photographs of the pattern. Add scale bar — draws a scale bar on an image using a saved calibration. About — version and author information.

The VibeScaler main window with five options: Quick start, Print pattern, Calibrate, Add scale bar, and About.
Main window.

Quick start sums up the three stages — print the pattern, calibrate, add a scale bar — on a single screen. For the full detail you are reading here, and the math behind the calibration, follow its Extended help link, which opens this document.

The Quick start window summarising the workflow, with an Extended help link at the bottom.
Quick start.

About shows the version and credits the authors.

The About window showing the version and the authors.
About.

With the app open, the full workflow is:

  1. Print the pattern.

    Click Print pattern. The calibration pattern opens as a PDF in your computer's default PDF viewer. Print it at 100% scale, with “fit to page” turned off, on a laser printer using plain white office paper (80–100 g/m²); choose the A4 or US Letter page to match your printer. The pattern is two black lines, each 0.2 mm wide, separated by a 0.2 mm gap.

    The calibration pattern open as a PDF in an external viewer, ready to print.
    The pattern opens as a two-page PDF for printing. Choose the appropriate page format to print.
  2. Cut out the pattern.

    Let the print cool for a minute or two, since warm laser toner can smear, then cut out the pattern. It sits at the bottom of the printed page, beneath the instructions.

    Photo of the pattern being cut from the bottom of the printed page.
    The pattern is at the bottom of the printed page.
  3. Place it on a glass slide.

    Lay the cut pattern flat on a clean microscope slide and set it on the stage under your objective.

    Photo of the cut pattern resting flat on a glass microscope slide.
    The pattern on a slide. Shown is the 3D-printed Educamacro from Educaciencia.
  4. Photograph the pattern through your microscope.

    Focus until both lines are sharp and fully inside the frame, then capture 20–30 images of different areas of the pattern. The lines do not need to be straight; tilted or diagonal frames are fine, because the app finds the angle automatically. Avoid strong glare that washes out the toner.

    Microscope view of the printed pattern: two dark parallel bands on a lighter, textured background.
    The pattern seen through the microscope.
  5. Calibrate.

    From the main window choose Calibrate…, add your photographs, and click Process. VibeScaler finds the two lines in each frame, marks them, and reports the distance between them in pixels (for example, “Distance: 678.00 px”). Review each result and Accept or Skip it; the counter (such as “Revised: 5/23”) tracks your progress. When you have reviewed the frames, click Save calibration… — you can save at any step. The calibration is written as a JSON file, and the app shows its details and the number of images it was built from.

    The Calibrate window: a processed frame with the two lines highlighted and the measured distance, alongside Process, Accept, Skip and Save calibration controls.
    Calibrating: review each frame, then save.
  6. Add a scale bar.

    From the main window choose Add scale bar and open the image you want to annotate — it must come from the same camera and zoom as the calibration. Load the saved calibration; the button confirms “Calibration OK”. Set the bar's appearance: its length in micrometres, its thickness in points, its colour (white, grey, or black), its orientation (horizontal or vertical), and, optionally, a text label with its own font size. Click on the image to move the bar where you want it. When you are satisfied, click Place bar to lock it in — after this the bar's properties can no longer be changed. Finally, use Save as… to save a copy of the image with the scale bar.

    The Add scale bar window: an image with bar-appearance controls for length, thickness, colour, orientation and label, plus Place bar and Save as buttons.
    Adding a scale bar.

Troubleshooting

Almost every problem comes from the capture step. If calibration finds no lines or fails, the lines are usually out of focus, only one line is in the frame, or glare is washing out the toner; refocus so both lines are sharp and complete, reduce the glare, and recapture.

If results vary a lot between frames, focus or framing drifted between shots — keep focus steady and the pattern flat, and capturing more frames lets the average settle.

If a scale bar looks too big or too small, the image was almost certainly taken with a different camera or zoom than the calibration, so re-calibrate for that setup.

How VibeScaler is built

VibeScaler is a Python application that leans on a few well-known, open-source libraries, each doing a specific job. Knowing what they are also explains some of its behaviour — for instance, why it needs Windows 10 or newer.

Graphical interfacePySide6, the official Python bindings for the Qt 6 toolkit — every window, button, and dialog. Qt 6 is also the reason Windows 10 or newer is required.
Image processingOpenCV — reading each frame, isolating the printed lines, finding their orientation and centroids, measuring the distance, and drawing both the calibration overlay and the final scale bar.
Numerical workNumPy — the array arithmetic behind the measurements, the averaging, and the consistency statistics.
Image loading & savingPillow — opening your photographs and writing the annotated result.
PackagingPyInstaller bundles Python and all of the above into a single self-contained application that needs no installation, so it can run from any folder or external drive.

The math behind calibration

Calibration reduces to one idea: find the centroids of the two printed lines, measure the distance between them in pixels, and divide the known real distance (set in the design) by it. Internally, the analysis routine processes each frame and returns the centroid distance in pixels (it calls this distance_px) together with the rotation angle it applied (best_angle). Here is what happens, step by step.

0.2 mm 0.2 mm 0.2 mm 400 µm (0.4 mm)
Centroid-to-centroid spacing = ½·0.2 + 0.2 + ½·0.2 = 0.4 mm = 400 µm.
  1. Threshold — separate the lines from the paper

    The frame is converted to greyscale intensity II and turned into a black-and-white mask, so the dark toner lines become the foreground. With a threshold TT:

    m(x,y)={1if I(x,y)<T0otherwisem(x,y)=\begin{cases}1 & \text{if } I(x,y) < T\\ 0 & \text{otherwise}\end{cases}
  2. Find the orientation — best_angle

    The two bars may sit at any angle. The routine searches for the rotation that lines them up cleanly and records it as θ\theta^{*} (best_angle); the mask is rotated by θ\theta^{*} so the bars become parallel to an axis. This is why a tilted frame works just as well.

    (xy)=(cosθsinθsinθcosθ)(xy)\begin{pmatrix}x'\\ y'\end{pmatrix}=\begin{pmatrix}\cos\theta^{*} & -\sin\theta^{*}\\ \sin\theta^{*} & \cos\theta^{*}\end{pmatrix}\begin{pmatrix}x\\ y\end{pmatrix}
  3. Centroids of the two lines

    Each line is a set of foreground pixels RkR_k (with k=1,2k=1,2). Its centroid is the mean position, weighted by the pixel value ww (1 for the binary mask, or darkness for a greyscale line):

    xˉk=(x,y)Rkxw(x,y)(x,y)Rkw(x,y),yˉk=(x,y)Rkyw(x,y)(x,y)Rkw(x,y)\bar{x}_k=\frac{\sum_{(x,y)\in R_k} x\,w(x,y)}{\sum_{(x,y)\in R_k} w(x,y)},\qquad \bar{y}_k=\frac{\sum_{(x,y)\in R_k} y\,w(x,y)}{\sum_{(x,y)\in R_k} w(x,y)}
  4. Distance between centroids — distance_px

    The straight-line distance between the two centroids, in pixels:

    dpx=(xˉ2xˉ1)2+(yˉ2yˉ1)2d_{\text{px}}=\sqrt{(\bar{x}_2-\bar{x}_1)^2+(\bar{y}_2-\bar{y}_1)^2}
  5. Scale of this frame — um_per_px

    The centroids are 400 µm apart in the real world (the constant the app calls D=400 μmD=400\ \mu\text{m}, built from ½ of the first line + the gap + ½ of the second line). So the scale of this frame, in micrometres per pixel, is:

    si=Ddpx,i=400 μmdpx,is_i=\frac{D}{d_{\text{px},\,i}}=\frac{400\ \mu\text{m}}{d_{\text{px},\,i}}
  6. Combine the accepted frames

    The calibration you save is the average of the scales from the frames you accepted. The spread of those values tells you how consistent your captures were — a small spread means a reliable calibration:

    sˉ=1Ni=1Nsi,σs=1Ni=1N(sisˉ)2\bar{s}=\frac{1}{N}\sum_{i=1}^{N}s_i,\qquad \sigma_s=\sqrt{\frac{1}{N}\sum_{i=1}^{N}\left(s_i-\bar{s}\right)^2}
  7. Draw a scale bar

    To draw a bar standing for a physical length LL, the app converts it back into pixels using the saved scale:

    Lpx=LsˉL_{\text{px}}=\frac{L}{\bar{s}}

Disclaimer

VibeScaler is provided free of charge and “as is”, with no warranty of any kind, express or implied. You use it entirely at your own risk and are solely responsible for any measurements or results you obtain with it. To the maximum extent permitted by law, the authors accept no liability for any loss or damage arising from its use.

You may use and share VibeScaler freely, provided it is passed on unmodified and in its complete original form. It may not be modified, sold, or reverse-engineered.

VibeScaler is a tool for hobbyist and educational microscopy, not a calibrated scientific instrument; treat its measurements as approximate.

Copyright & contact

Feedback is always welcome. So far VibeScaler has been tested with a pattern printed on a Canon MF272dw laser printer and a calibration carried out on a Nikon Eclipse Ti microscope; other printer and microscope models remain to be tested. If you try it with different equipment, please email the authors with example images — this helps widen the tested database and may allow correction factors in future versions.

Copyright © 2026 Vad Pérez and Martin Schätz
Version VibeScaler 0.1
Vad Pérez vadim.perez@imss.gob.mx · works @ zenodo
Martin Schätz martin.schatz.cz@gmail.com · schaetz.cz
Credits Vibe coded with ChatGPT 5.0 and Claude Opus 4.5-4.8; designed in Affinity Designer.