@OP - Many programs provide the resizing feature you requested at the press of a button. It often goes under a name like, "Fit to bounding box" or "Fit longest dimension", etc. I use this feature in Photo Mechanic all the time (see attached screen shot). I'm 99% sure it is also available in Faststone Image Viewer, Faststone Image Resizer, Image Magik, the export module of Lightroom, and many, many other programs.
Since it sounds like you are processing a bunch of images and need all of them to have a specified blank area around the image area, after resizing, you could expand the canvas in a 2nd separate step in any of the above programs (as a fast batch process), or, perhaps even faster, just use the "Create Contact Sheet" feature in any of the above programs and then cut them out of there using Photoshop's semi-automatic "slice" tool.
It turns out that just last night I was helping the local volunteer fire department set up mug shots for all their staff -- around 350 people in total. The fire / ambulance chief did all the hard work of gathering all the photos, naming them, etc. I came around with a copy of Faststone Image viewer, set the parameters, and it chewed through all 350 mug shots in under a minute on a slow, 5 y.o. laptop. He wanted them displayed as contact sheets, so I didn't even have to use PS's image slice tool.
HTH,
Tom M