Make Product Page Images adaptive to it's own height

Dear team, is it possible by using css to make the product page images adaptive to each of its height , given that they are not in the same height , the image slider will pick the one with largest height , if it’s not the first image, there will be a very big white space there, thanks a lot!

Dear @UniqueGem thanks for your prompt help! Might I know what css please?