This is a little plugin ob-align.py by Oberon Leung, that is in danger of being lost, so this post to keep it alive.
There are other similar plugins and of course command line ImageMagick has a similar function.
However, ob-align.py, providing you are not too ambitious, is easy to use.
A 4 minute demo
The plugin is attached, remember to unzip it. Pop it in your Gimp profile, in Windows, C:\Users\your-name\.gimp-2.8\plug-ins