OK, I was just about to jump in with a "the camera is irrelevant", when I remembered reading something about this being part of the D5100's capabilities.... checked it out and it's on page 120 of
your Manual. I've no idea whether it does a better job than editing as described above, but it can only be applied to Jpegs in camera, so if you're a Raw shooter you'll need the suggestions above and do it in editing,
There was, I think, a decent tutorial for this kind of editing on here when it was PhotoRadar - before it got re-organised - and now I cannot find it (or any other trace of a list of tutorials).
However, I
came across this one for you.