Let’s say you have an image with useless space all around the subject, and you’d like to trim it to get only what you need:
Simply choose Image > Trim.
In the dialog box, choose either Transparent pixels if your image have a transparent background, or Top Left / Bottom Right Pixel Color if your image, like this exemple, have a color background.
And here is the result!