ToolsConductScience tool
Image AnalysisFree in-browser calculator

Porosity Calculator.

Upload a micrograph, apply Otsu thresholding, and calculate porosity as area fraction. Client-side processing — images never leave your browser.

PrivateData stays in your browser
LiveNo sign-up required
Open methodFormula shown on this page
CitableMethods and citation included

Calculator

Results update in place

Try it out

Load example porosity data to see the full workflow

Upload a micrograph

Drag & drop or click to browse — any image format

When to use

  • Estimate porosity (area fraction) from metallographic or ceramic micrographs
  • Quick threshold analysis of SEM or optical microscopy cross-sections
  • Educational demonstrations of Otsu thresholding and image binarization
  • Compare porosity across different processing conditions or sample locations
  • Screen cast, sintered, or additively manufactured parts for void content

Do not use for

  • Images with severe uneven illumination (use local adaptive thresholding)
  • Multi-phase materials where pores are not the darkest (or brightest) phase
  • 3D porosity measurement — use micro-CT or Archimedes method
  • Formal ASTM compliance reporting without multi-field analysis

Check the histogram before trusting the Otsu value

Otsu's method assumes a bimodal histogram. If your histogram is unimodal (e.g., very low porosity < 2%), multimodal, or has a long tail, the automatic threshold may be suboptimal. Always inspect the histogram overlay and adjust manually if the binary image doesn't visually match your assessment of pore locations.

JPEG artifacts create phantom porosity

JPEG compression introduces intensity variations at block boundaries (8x8 pixel blocks) that can be misclassified as pores at certain thresholds. Use PNG or TIFF images when possible. If you must use JPEG, apply a slight Gaussian blur before thresholding (not available in this tool — preprocess in ImageJ or GIMP).

Representative sampling matters more than threshold precision

The single biggest source of error in porosity measurement is usually field-of-view selection bias, not threshold choice. Porosity can vary 2-5x across a sample cross-section. Analyze at least 5 non-overlapping fields at consistent magnification and report the mean and standard deviation.

Magnification affects apparent porosity

At low magnification, small pores below the resolution limit are missed, underestimating porosity. At very high magnification, you see fewer pores per field and the sampling variance increases. Choose a magnification where the smallest pores of interest span at least 3-5 pixels.

1

Method

Grayscale conversion uses ITU-R BT.601 luma weighting (0.299R + 0.587G + 0.114B). Otsu's threshold is computed by maximizing between-class variance over all 256 intensity levels. Porosity is calculated as the ratio of pore pixels to total pixels. The 95% confidence interval is derived from the binomial standard error: SE = sqrt(p(1-p)/n), where p is the area fraction and n is the total pixel count. All processing uses the browser Canvas API — no server upload.

2

Published

Published 2026-04-05. Calculations support planning and documentation; verify procurement decisions against manufacturer specifications or institutional SOPs.

3

How to cite

How to Cite

ConductScience Porosity Estimator. ConductScience, Inc. 2026. Available at: https://conductscience.com/tools/porosity-calculator

Otsu N. A threshold selection method from gray-level histograms. IEEE Trans Syst Man Cybern. 1979;9(1):62-66. doi:10.1109/TSMC.1979.4310076

ASTM E1382-97. Standard Test Methods for Determining Average Grain Size Using Semiautomatic and Automatic Image Analysis. ASTM International. doi:10.1520/E1382-97R23

What Is Porosity Measurement in Materials Science?

Porosity — the volume fraction of void space in a solid — is one of the most fundamental microstructural parameters in materials science. It governs mechanical properties (strength, stiffness, fatigue life), transport properties (permeability, diffusivity), and functional performance (thermal insulation, biocompatibility).

Common measurement techniques include Archimedes' method (buoyancy), mercury intrusion porosimetry, gas adsorption (BET), micro-CT, and image analysis. Image-based methods using optical or electron micrographs provide spatial information that bulk methods cannot: pore size distribution, shape, connectivity, and spatial arrangement.

The simplest image analysis approach is global thresholding — converting a grayscale micrograph to binary (pore vs. matrix) using an intensity cutoff, then counting the fraction of pore pixels. Otsu's method automates the threshold selection step.

Understanding Otsu's Thresholding Method

Nobuyuki Otsu published his automatic thresholding method in 1979. The algorithm assumes the image histogram is bimodal — two overlapping distributions representing two phases (e.g., pores and matrix). It exhaustively tests every possible threshold from 0 to 255 and selects the one that maximizes the between-class variance:

σ²_B(t) = ω₀(t) · ω₁(t) · [μ₀(t) − μ₁(t)]²

where ω₀ and ω₁ are the class probabilities and μ₀ and μ₁ are the class means at threshold t.

Otsu's method works well when the histogram is clearly bimodal with similar class sizes. It can struggle with highly skewed distributions (very low or very high porosity), uneven illumination, or multimodal histograms. In these cases, manual threshold adjustment or local adaptive thresholding may be needed.

Relevant Standards for Porosity Measurement

Several ASTM and ISO standards govern image-based porosity and phase fraction measurement:

  • ASTM E1382: Standard Test Methods for Determining Average Grain Size Using Semiautomatic and Automatic Image Analysis — includes area fraction procedures applicable to porosity.
  • ASTM E562: Standard Test Method for Determining Volume Fraction by Systematic Manual Point Counting — the manual grid-based predecessor to automated image analysis.
  • ASTM B311: Standard Test Method for Density of Powder Metallurgy (PM) Materials — Archimedes method for bulk porosity.
  • ISO 9276: Representation of results of particle size analysis — relevant for pore size distributions.

For formal reporting, multiple fields of view (typically 5+) should be analyzed, and results reported as mean ± standard deviation with the number of fields, magnification, and thresholding method documented.

Frequently asked

What is porosity and why does it matter?
Porosity is the fraction of void space (pores) in a material. It directly affects mechanical strength, permeability, thermal conductivity, and fatigue life. In metals, high porosity from casting defects reduces load-bearing capacity. In ceramics and biomaterials, controlled porosity enables fluid transport and tissue ingrowth. Accurate porosity measurement is essential for quality control and materials development.
How does Otsu's thresholding work?
Otsu's method automatically selects the optimal intensity threshold to separate an image into two classes (foreground and background) by minimizing within-class variance — or equivalently, maximizing between-class variance. It examines all 256 possible thresholds on the grayscale histogram and picks the one that best separates the two intensity populations. No user tuning is required for the initial estimate.
When should I use the Invert toggle?
By default, the tool treats dark pixels (below threshold) as pores and bright pixels as matrix — the most common convention for optical micrographs of metals and ceramics. If your image has bright pores on a dark background (e.g., fluorescence microscopy, backscatter electron images, or certain polymer foams), enable Invert so bright pixels are counted as pores.
How accurate is the area fraction measurement?
The area fraction is exact for the given threshold on the given image. The reported 95% confidence interval is a binomial standard error estimate that quantifies pixel-level sampling uncertainty. However, the overall accuracy depends on image quality, representative sampling (field of view selection), adequate resolution, proper sample preparation, and correct threshold selection. For formal reporting per ASTM E1382, analyze multiple fields and report the mean and standard deviation.
Are my images uploaded to a server?
No. All processing happens entirely in your browser using the Canvas API and JavaScript. Your micrograph images never leave your computer. The tool works offline after the page loads.
What image formats are supported?
Any format your browser can decode — JPEG, PNG, WebP, BMP, TIFF (in supported browsers), and more. For best results, use uncompressed PNG images. JPEG compression artifacts can create false pore boundaries near the threshold.
Can I measure porosity in 3D samples?
This tool measures 2D area fraction from a single cross-section image. For isotropic microstructures, the 2D area fraction equals the 3D volume fraction (the Delesse principle). For anisotropic or oriented porosity, you need multiple cross-sections at different orientations or a 3D technique like micro-CT.
325
Free tools
1,200+
Institutions
100%
Client-side
0
Uploads required