In the current work, a molecularly imprinted polymer (MIP) as a smart sorbent was prepared for the selective recognition of n-propyl gallate (n-PG) in complex food samples. A computational study was used to design a selective and efficient MIP toward n-PG. MIP has been synthesized on the cellulose substrate and used as a smart sorbent in microextraction by the packed sorbent (MEPS) method. Digital image colorimetry (DIC) was utilized to assay the generated color on the thin film platform. Based on the method validation, the linear dynamic range was 0.1–1 µg mL−1 and 1–10 µg mL−1 for natural sesame oil. The limit of detection and limit of quantification for natural sesame oil were 0.03 and 0.1 µg mL−1, respectively. The developed MIP-MEPS combined with DIC assay was successfully applied to determine of n-PG in some vegetable edible oils, leading to acceptable relative recoveries in the range of 83.0 % to 108.6 %.