Coherent diffractive imaging (CDI) and scanning transmission x-ray microscopy (STXM) are two popular microscopy techniques that have evolved quite independently. CDI promises to reach resolutions below 10 nanometers, but the reconstruction procedures put stringent requirements on data quality and sample preparation. In contrast, STXM features straightforward data analysis, but its resolution is limited by the spot size on the specimen. We demonstrate a ptychographic imaging method that bridges the gap between CDI and STXM by measuring complete diffraction patterns at each point of a STXM scan. The high penetration power of x-rays in combination with the high spatial resolution will allow investigation of a wide range of complex mesoscopic life and material science specimens, such as embedded semiconductor devices or cellular networks.