Metal halide perovskites exhibit substantial potential for advancing next-generation x-ray detection. However, fabricating high-performance pixelated imaging arrays remains challenging due to the substantial dark current density and stability issues associated with common organic-inorganic hybrid perovskites. Here, we develop a vapor deposition method to create the first all-inorganic perovskite heterojunction film. The heterojunction introduction effectively reduces the dark current density of detectors to about 0.8 nA·cm-2, satisfying thin-film transistor (TFT) integration standards, while also increases sensitivity to above 2.6 × 104 μC·Gyair-1·cm-2, thus giving rise to a record low detection limit of <1 nGyair·s-1 among all polycrystalline perovskite-based x-ray detectors. The devices also demonstrate remarkable stability across multifarious demanding working conditions. Last, through monolithic integration of the heterojunction film with a 64 × 64 pixelated TFT array, we have achieved high-resolution real-time x-ray imaging, which paves the way for the application of all-inorganic perovskite in low-dose flat-panel x-ray detection.