Photoshop and record an action to run as a batch.
You do have a decision to make.
Since the aspect ratios are different you need to decide if you want to be consistent on height or width then let the other fall where it may.
Or you can go a bit farther and separate by portrait or landscape to maximize the image area.
Here are two from my site where the canvas is a consistent size but the portraits fill the height and the landscapes fill the width
http://southpeakgames.com/source/sites/default/files/lbox/pc/Bx_Igor_PC.png
http://southpeakgames.com/source/sites/default/files/lbox/ds/Bx_Igor_DS.png
The canvas is 123x164 so the portrait has transparent pixels l/r while the landscape has transparency top/bottom.
Building the action is nothing more than;
Create a new one
Start recording
Go through the steps
Save the action
Run it as a batch on a folder