High-resolution hard x-ray magnetic imaging with dichroic ptychography