read.csv("aremonia.csv")| X.1 | Label | Area | Area_mm2 | X | Y |
|---|---|---|---|---|---|
| 1 | aremonia.bmp | 335104 | 2402.174 | 1954.716 | 1278.811 |
| 2 | aremonia.bmp | 475349 | 3407.513 | 1310.547 | 2317.125 |
| 3 | aremonia.bmp | 347537 | 2491.300 | 500.376 | 1590.916 |
Luciano L.M. De Benedictis
14 Aug 2026
The measurement of leaf area is common both in functional plant ecology and in agronomy, where it is one of several high-throughput phenotyping measurements.1 A clever way to measure it is to start from flatbed scans or reasonably flat (and distortion-corrected) images. It goes somewhat like this:
The question is what step 2 should look like. There are quite a few programs, most of them from the 20th century, with a point-and-click interface to do this task on one image: this gets unwieldy if you have more than one leaf to measure, and they have other quirks2. What’s desirable is a batch processing solution with some amount of manual supervision, because leaf scans are rarely perfect, and deciding which pixels count towards the leaf area isn’t always straightforward.
I made such a solution, called the Leaf Area Script, which you can find on Github and try for yourself. This is actually a collection of shell and powershell scripts covering all combinations of OS and ImageJ/Fiji. They are designed to work on most operating systems, require minimal setup, and quickly process many images. I won’t get into all the details, which are explained quite well at the link, but all you need to do is to drop images in any raster format, color, grayscale or binary, in the script folder3, run the script and check the measurements stored in the FAIRest format of all: CSV.
The script relies on ImageJ (or Fiji), a venerable and respected free software to extract quantitative measurements from images. It is used directly for area measurement by some people, but it falls in the point-and-click category above. There are more powerful programs available too, some of them paid, but the strength of ImageJ is its scripting (macro) interface. This allows for automating the processing steps, a feature exploited by the LeafArea R package, which inspired my script.
A surprising number of programs ask you to click on two points on a reference image, including ImageJ in its own leaf area tutorial: ImageJ can output pixel counts, or areas if the length of a selected segment is set. Thanfkully, this can be avoided: all you need to do is calculate the area of a pixel, and you can derive this directly from the scan DPI4 \[pixel~area(mm^{2}) = (25.4/DPI)^{2}\]
If you don’t know the DPI exactly, the script allows you to insert the physical size of the scan (usually close to standard paper sizes) and work out DPI from the image resolution. The more accurate are the dimensions of the scanned area, the more accurate the area in this case.
Both of these options are more intuitive than in the package, where you need to input a reference length and its equivalent in pixels.
Another feature I wanted was threshold adjustment: the scan needs to be made binary to classify leaf and non-leaf pixels; this is not always easy in real-world scans, where leaf margins can be unclear, the leaf lamina might not be so dark because of reflections, and thicker leaves can result in shadows. ImageJ has several thresholding methods, which could all be supported by the script, but the default one works well most of the times: if you need to, you can input a manual threshold instead of the automatic one, and find the best value by trial and error.
How do you check the results? Alongside a CSV summary of the area by image, the script outputs per-image CSVs and the images processed by ImageJ: from this you can check the area of individual particles (ImageJ term) and their coordinates, then match them to the numbers in the images and check if the borders look fine.
I think these simple steps to reduce user error and check results can do a lot to reduce methodological variation, especially when different data sources are combined. This might seem like a simple task, but even after scanning different ways to convert pixels to areas, different thresholds which result in erosion or inflation of the leaf lamina, filtering or not of small dust particles, filling in pixels inside the leaf margin can all affect the measurement.
How does it look in practice? Let’s take this example: a scan of three leaves of Aremonia agrimonoides, which is a black and white bitmap (it doesn’t have to be either of those things) with some specks of dust getting through:

Running the script with just this image looks like this. You’re asked values for each setting, and I chose some sensible defaults:

This will generate an image with numbered outlines, a CSV for each image which looks like this
| X.1 | Label | Area | Area_mm2 | X | Y |
|---|---|---|---|---|---|
| 1 | aremonia.bmp | 335104 | 2402.174 | 1954.716 | 1278.811 |
| 2 | aremonia.bmp | 475349 | 3407.513 | 1310.547 | 2317.125 |
| 3 | aremonia.bmp | 347537 | 2491.300 | 500.376 | 1590.916 |
and a summary file with one line for each image and its total leaf area:
I would be remiss if I didn’t check other solutions, even if I think relying on well known external software like ImageJ and Fiji for the image processing ensures more reliability. I didn’t or couldn’t test all of them.
Some people who are really into Citrus were so proud of their script that they made a paper about it. This one is the most similar to mine, and it was easy enough to test, but I have a few issues with it. You have to manually set up input and output folders and write them in the python script. Then you have to click on a ruler each time you run the script to give a reference: making a “ruler” image in the right DPI with a 1 cm line isn’t hard, but hardly necessary and clicking is error prone (clicking on a 10-cm length would be more precise). It’s picky with the input images, for example it didn’t like half of my test images. It’s not customizable, you have to trust the defaults to do a good job with your scans
pliman seems nice if you prefer an R package
Leaf Area Meter is an unmantained python script and the syntax is more complicated, since you have to input all parameters as arguments instead of working with interactive terminal prompts
LeafAreaCalc looks like a python script with a UI and some traces of ChatGPT. The installation is more involved, in fact I was not able to test it because the indicated list of dependencies was not available
At least this is my guess based on what I saw while doing this research↩︎
One of these programs, if you can even find it online, requires specifically a monochrome bitmap input format, which is quite hard to come by in this age. A previous solution I made was an ImageMagick script converting images into this format with a set threshold.↩︎
Or copy the script where the images are stored, as you prefer↩︎
Think of 1/DPI as the pixel width in inches. This assumes square pixels which are vastly more common. Rectangular pixels were used mostly for video broadcasting↩︎