I guess you are using Imagemagick.The problem is not related to any software, simply you will need to do a resize keeping each photo ratio, then a crop using the other ratio(you need to loose part of the image, then, and in other cases, add a chunk at the bottom of solid black, etc). I tend to do this with certain freeware, Irfanview. Using Batch option (just open one image in the folder with irfanview, and hit b key) , I'd set advanced options as checked, then use the options there to resize and crop, it offers quite flexibility.
Nothing you couldn't do with Imagemagick, though, Surely you are letting it stretch, but you could possibly force the crop without changing the ratio...
Other way is using Photoshop automate menu, combining with an Action(macro) previously done by you.