In this Letter, we report on an algorithm and its implementation to reconstruct the wavefront as a continuous function from a bitmap image of the Hartmann–Shack pattern. The approach works with arbitrary raster geometry and does not require explicit spot definition and phase unwrapping. The system matrix, defining the coefficients of wavefront decomposition in the system of basis functions, is obtained as a result of a series of convolutions and thresholding operations on the reference and sample images. © 2020 Optical Society of America