Batch resize to canvas from different ratio images
I need to resize a huge library of product photos but they are all cropped to fit the product with no extra space on the sides/tops.
I've read a lot of tutorials on resizing an image to fit a canvas but my problem is I need a solution that fits for images that are originally cropped as either portrait or landscape to resize into a 1024x768 canvas at maximum size. So if I have a portrait image, I want the height to resize to 768 and keep its original width and not get distorted. If its landscape but oddly cropped e.g. think of a toothbrush cropped to the point of having no space around it. I need that image inserted into that same 1024x768 canvas so its width is 1024 but its height remains the same.
Is there a way to handle both situations with one batch? I have thousands of images and it would be difficult to sort out the portrait from the landscape and the run a different script.