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.
Select pixels
. Alternatively:Ctrl + Left click
the thumbnail ( Cmd+click on mac). Also, what is it that you're trying to do, that requires you to make that selection? I'm just thinking that it might be possible to skip this step or otherwise improve the workflow.