Near field computational imaging has been recognized as a promising technique for non-destructive and highly accurate detection of the target. Meanwhile, reconfigurable intelligent surface (RIS) can flexibly control the scattered electromagnetic (EM) fields for sensing the target and can thus help computational imaging in the near field. In this paper, we propose a near-field imaging scheme based on holograghic aperture RIS. Specifically, we first establish an end-to-end EM propagation model from the perspective of Maxwell equations. To mitigate the inherent ill conditioning of the inverse problem in the imaging system, we design the EM field patterns as masks that help translate the inverse problem into a forward problem. Next, we utilize RIS to generate different virtual EM masks on the target surface and calculate the cross-correlation between the mask patterns and the electric field strength at the receiver. We then provide a RIS design scheme for virtual EM masks by employing a regularization technique. The cross-range resolution of the proposed method is analyzed based on the spatial spectrum of the generated masks. Simulation results demonstrate that the proposed method can achieve high-quality imaging. Moreover, the imaging quality can be improved by generating more virtual EM masks, by increasing the signal-to-noise ratio (SNR) at the receiver, or by placing the target closer to the RIS.