We demonstrate a method to locally change the refractive index in planar optical devices by photodarkening of a thin chalcogenide glass layer deposited on top of the device. The method is used to tune the resonance of GaAs-based photonic crystal cavities by up to 3 nm at 940 nm, with only 5% deterioration in cavity quality factor. The method has broad applications for postproduction tuning of photonic devices.