Near-field imaging of perfectly conducting grating surfaces