Chart DigitizerDWG № 01 · REV A

Open-source plot digitizer · MIT

Photograph a chart.
Get the numbers back.

Chart Digitizer turns a phone photo of a printed line chart into clean x, y data: CSV, JSON and a re-plot. It finds the plot, undoes the perspective, strips the gridlines and text, and traces the curve. You type the axis ranges; it does the rest.

  • No OCR · No ML
  • Runs offline
  • CLI + web app
  • Linear & log axes
  • Python
The Chart Digitizer web app showing the extracted points plotted and listed in a table
A tilted, unevenly lit phone photo of a line chart with gridlines and scatter points
Fig. 1 · Input photo
§ 01 · Spec

Built for real photos, not clean exports.

Most digitizers expect a tidy screenshot and a lot of clicking. Chart Digitizer is for the curve in a datasheet, a figure in an old paper or a chart on a whiteboard, photographed at an angle in bad light.

Geometry

Finds and straightens the plot

The frame is detected with Hough lines and warped upright with a homography, undoing perspective and rotation.

Clutter

Ignores what isn't the curve

Gridlines, reference lines, scatter points, legends and text are removed, but the curve is kept where it crosses them.

Tracing

Follows the right line

Dynamic programming traces the dominant curve, or the one matching --curve-color. Short hidden stretches are bridged and flagged.

Axes

Linear and log

Either axis or both can be logarithmic. Sample at N points, at a fixed step, or at exactly the x values you need.

Honesty

Never guesses silently

Every point is flagged measured, gap-filled or out of range. No extrapolation. Errors name the stage that failed and what to try.

Privacy

Nothing leaves your machine

No cloud, no API keys, no models to download. The web app listens on 127.0.0.1 only.

§ 02 · Method

How it works

Long straight lines are grouped into the four plot corners and a homography warps the plot square. Shading is divided out, gridlines and text are removed by morphology, the curve's ink is picked out in CIELAB, and a dynamic-programming path traces it. Every stage is classical and inspectable. Run with --debug, or open the Stages tab in the web app, to see the image after each one.

Pipeline: find the frame, rectify, strip clutter, isolate the curve, trace and sample
§ 03 · Tolerance

Accurate to a fraction of a percent.

Measured on synthetic charts with simulated camera damage, where the true curve is known exactly. Error is RMSE as a percentage of the y-range, for the worst chart in each set.

Three examples: a tilted phone photo, a coloured wavy curve and a log-log chart, each beside its digitized re-plot
ChartsCornersWorst RMSE
Cleanexact0.07%
Gridlines, reference lines, textexact0.26%
Plus perspective, blur, noise, shadingexact0.28%
Degradedautomatic0.28%
Log axesexact0.08%
Log axesautomatic0.16%

On a real photo

A phone photo of a printed datasheet chart: all seven hand-read check points within ±1.5% of full scale, with corners found automatically.

One curve per run, as a function of x. You supply the axis ranges; that is the price of no OCR. See the limitations.

§ 04 · Bench

A web app that shows its work.

Drop in a photo, check the corners with a magnifying loupe, press Digitize. Hover the chart to find a row in the table, copy it into a spreadsheet, or download CSV and JSON.

§ 05 · Procedure

Quick start

You need Python 3.11+ and uv. Works on Windows, macOS and Linux.

Install

$ git clone https://github.com/ov9bo/Chart-Digitizer.git
$ cd Chart-Digitizer
$ uv sync

Digitize

# a photo, with the axis ranges
$ uv run digitize chart.jpg --x-range 0,100 --y-range 0,100
# or the web app at 127.0.0.1:8765
$ uv run digitize-ui

Out come points.csv, points.json, overlay.png and replot.png. Batch a folder with uv run digitize charts/. Full options are in the README.

§ 06 · Notes

Questions

How do I extract data from a graph image?

Run uv run digitize chart.jpg --x-range LO,HI --y-range LO,HI, or start the web app with uv run digitize-ui and drop the image in. The curve comes back as x, y pairs in points.csv and points.json, at 50 evenly spaced x values by default or at the x values you choose.

Can it digitize a photo taken with a phone?

Yes, that is what it is for. It finds the plot frame, corrects perspective and rotation, flattens uneven lighting, and removes gridlines and annotations before tracing. If the frame isn't found, you click the four corners yourself.

How is it different from WebPlotDigitizer?

WebPlotDigitizer is an excellent, mature tool for picking points on clean chart images, and handles bar and polar charts too. Chart Digitizer is aimed at photos of line charts: it straightens the plot, strips clutter and traces the whole curve automatically, and can batch a folder unattended from the command line.

Why no OCR or AI?

Predictability. Every stage is classical and inspectable, it runs offline with a few well-known dependencies, and it either gives an answer you can check against the overlay or tells you which stage failed and why. Typing four axis numbers is a small price for that.

Does my image leave my computer?

No. The command-line tool makes no network connections, and the web app serves on 127.0.0.1 and rejects requests from other sites.