According to add_image_size()
you can do something like that with width
but I imagine it works the same with height
:
$width
(int) (optional) The post thumbnail width in pixels. Set to 9999 to resize based on $height
Default: 0
Really I think you would want to set it to something ridiculously high which 9999 should work for you. You could test this and use a plugin like Regenerate Thumbnails to try it out or revert your changes if it doesn’t work.