Pixel Art Integer Scale

Game graphics

How Pixel Art Integer Scale works

Find the largest whole-number image scale that fits a viewport, with dimensions and centered padding.

Use an integer multiplier

Divide available width by source width and available height by source height. Round both down and choose the smaller result. This is the largest whole-number enlargement that fits.

Calculate centered padding

Multiply source dimensions by the selected scale. Subtract the scaled dimensions from the available dimensions and split each difference between the two opposite sides. If the difference is odd, the right or bottom receives the extra pixel.

Preserve the intended look

A whole-number pixel scale can preserve uniform pixel blocks with nearest-neighbor rendering. Actual CSS pixels, device pixels, browser zoom, texture filtering and engine camera settings may differ. If the source is larger than the viewport, this tool reports that no positive integer enlargement fits rather than proposing fractional scaling.

Worked example

A 320 × 180 pixel source fits exactly into a 1920 × 1080 viewport at 6× scale. In a 1366 × 768 viewport, 4× fits, giving a 1280 × 720 image and centered padding.

Try the calculator

About the method

This tool uses the stated arithmetic and assumptions. Test the worked example and confirm the inputs before using the result.