Methodology
Transparent formulas and predictable rounding
The toolkit uses standard arithmetic with full precision internally and only rounds when displaying a result or when a whole pixel is required.
Core formulas
megapixels = width × height ÷ 1,000,000
print inches = pixels ÷ DPI
required pixels = inches × DPI
centimeters = inches × 2.54
aspect ratio = width ÷ GCD : height ÷ GCDRounding rules
Physical dimensions retain full JavaScript number precision and are normally displayed with up to two or four decimal places. A proportional pixel dimension is rounded to the nearest whole pixel. Required pixels for a target print are rounded up so the result does not fall below the selected density.
Input validation
Values must be positive and finite. Pixel dimensions must be whole numbers. The public calculators accept values up to 100,000 to prevent accidental inputs that are unlikely to represent a practical image.
Image handling
The file picker uses the browser File API and an in-memory object URL to read natural width and height. The URL is revoked immediately after the dimensions are read. No upload endpoint is called.
Verification
The shared calculation module is covered by automated tests, including 3600 × 2400 pixels at 300 DPI equaling 12 × 8 inches, proportional 16:9 resizing, megapixel totals, and centered crop calculations.
Print disclaimer
A mathematically correct density does not guarantee a particular visual result. Printer technology, material, source sharpness, compression, resampling, and viewing distance all matter.