Skip to content

lbarjak/diffraction-limit-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Diffraction Limit Calculator

A browser-based tool that tells you at which f-number your camera sensor becomes diffraction-limited.

🔗 Live demo: https://lbarjak.github.io/diffraction-limit-calculator/


What is diffraction limiting?

When you stop down a lens (increase the f-number), diffraction causes light to spread into an Airy disk pattern. If the Airy disk becomes larger than a single pixel, the lens can no longer resolve detail at the pixel level — this is called diffraction limiting.

The critical f-number N_critical is the point where the Airy disk diameter equals the pixel pitch. Shooting at f-numbers higher than N_critical will degrade sharpness regardless of how sharp the lens is.


Formula

horizontal_pixels = sqrt(megapixels × 1,000,000 × (sensor_width / sensor_height))

pixel_pitch (mm) = sensor_width / horizontal_pixels

N_critical = pixel_pitch / (1.22 × λ)     where λ = 0.00055 mm (550 nm green light)

Airy_disk_diameter = 2.44 × λ × N

Usage

  1. Open the app in a browser.
  2. Select a preset camera from the list, or choose Custom… to enter your own sensor parameters.
  3. If custom: enter sensor width (mm), sensor height (mm), and megapixels.
  4. The results page shows:
    • Calculated pixel pitch (µm)
    • N_critical — the diffraction-limiting f-number
    • A visual f-stop scale bar with a green (sharp) zone and a red (diffraction-limited) zone

File structure

index.html          — Main HTML, inline CSS, <script type="module"> entry point
src/
  app.js            — App class: orchestration
  sensordata.js     — SensorData class: preset camera data
  calculator.js     — Calculator class: diffraction calculations
  menu.js           — Menu class: preset selection and custom input form
  display.js        — Display class: results and visual f-stop scale bar

Running locally

No build step required. Serve the project root with any static file server:

npx serve .
# or
python3 -m http.server 8080

Then open http://localhost:8080 in your browser.

Note: You must use a server (not file://) because ES6 modules require HTTP(S).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors