Ultrafast real-time optical imaging is an indispensable tool for studying dynamical events such as shock waves, chemical dynamics in living cells, neural activity, laser surgery and microfluidics. However, conventional CCDs (charge-coupled devices) and their complementary metal-oxide-semiconductor (CMOS) counterparts are incapable of capturing fast dynamical processes with high sensitivity and resolution. This is due in part to a technological limitation-it takes time to read out the data from sensor arrays. Also, there is the fundamental compromise between sensitivity and frame rate; at high frame rates, fewer photons are collected during each frame-a problem that affects nearly all optical imaging systems. Here we report an imaging method that overcomes these limitations and offers frame rates that are at least 1,000 times faster than those of conventional CCDs. Our technique maps a two-dimensional (2D) image into a serial time-domain data stream and simultaneously amplifies the image in the optical domain. We capture an entire 2D image using a single-pixel photodetector and achieve a net image amplification of 25 dB (a factor of 316). This overcomes the compromise between sensitivity and frame rate without resorting to cooling and high-intensity illumination. As a proof of concept, we perform continuous real-time imaging at a frame speed of 163 ns (a frame rate of 6.1 MHz) and a shutter speed of 440 ps. We also demonstrate real-time imaging of microfluidic flow and phase-explosion effects that occur during laser ablation.