GIMP has a very useful feature for the Rect Select Tool: "Auto Shrink". It shrinks the rectangular selection to the rectangle of a smallest size which still contains all NON-TRANSPARENT PIXELS of the original selection. Please see the example below.
Is there any way to do this in Photoshop? I know there is a way in Photoshop to crop the whole image to a smallest size, but I don't want to change the image size. I just want to shrink the selection.