Force an image to be minimum height?

I have been sizing my product images to be a maximum of 600x600 for years. But I have some images that are kind of short compared to the 600px width. Google is telling me they don’t like a lot (thousands) of images on my site because they are below 100px tall so they need to be taller. I plan on upgrading many of the images to be 1000x1000 (since that seems more the norm these days) but until then, is there a way in the templates to force the image to be a minimum of 100px tall?

The following post is the reverse of what you are looking for, but potentially there are settings in some of the suggested add-ons that might help Images taking a lot of space

If you want to find and upsize your images you can try this script (untested - use on a copy of your site first). Update your path where indicated

Place this script in a file e.g. grow_my_image.php

// path to your images directory
$dir = new RecursiveDirectoryIterator('/path/to/your/images/');

// iterate over each file in the directory and its subdirectories
foreach (new RecursiveIteratorIterator($dir) as $filename => $file) {
    // only process jpg, png, and gif images
    $ext = pathinfo($filename, PATHINFO_EXTENSION);
    if (!in_array($ext, array('jpg', 'png', 'gif'))) {

    // get the image dimensions
    list($width, $height) = getimagesize($filename);

    // check if the height is less than 100
    if ($height < 100) {
        // load the image
        $image = imagecreatefromjpeg($filename);

        // calculate the new height
        $new_height = 100;

        // calculate the new width to maintain the aspect ratio
        $new_width = ($width / $height) * $new_height;

        // create a new image with the new dimensions
        $new_image = imagecreatetruecolor($new_width, $new_height);

        // copy and resize the old image into the new image
        imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

        // save the new image over the old one
        imagejpeg($new_image, $filename);

        // free up memory

This is a simplified script and it may not cover all your needs, such as error checking and handling different image formats. You should also be careful with resizing images as it can degrade image quality, especially when upscaling if you have any icon or button images in particular this could be a issue, you could maybe alter script to exclude images under 30x30 on the assumption that these are that type of image.

I was hoping this would work but in my testing (test folder on the server) I get a 500 error when trying to run the script. I was using WebP images but I changed the script to allow those but no good.