We introduce a new physical process that can perform a complete time-reversal operation on any electromagnetic pulse. The process uses only small refractive index modulations of linear optical elements. No nonlinear multiphoton effects such as four-wave mixing are required. The introduced process can be implemented on chip with standard semiconductor materials. Furthermore, the same process can be used to compress or expand the spectrum of electromagnetic waves while completely preserving the coherent information. We exhibit the time-reversal process by first-principles simulations of microcavity complexes in photonic crystals.