Imagine a picture of a whole person.
If you want the whole person to display at full width but you want to limit the height of the person do you change the person to be short and fat rather than tall and slim ? 
If you want the person to stay the same shape but you still only want the image to be half as tall then you have to crop the persons legs or head out of the picture. It can’t remain a picture of the same person without being cropped in some way.
The above is a real life and follows the laws of physics.
So, what I am getting at is you cannot simply stretch a picture to fit a certain width and height unless you either stretch or squash one or both directions. That obviously distorts the image and cannot be used for real world images. On the other hand you can maintain the image’s aspect ratio but as in the example of the person you would either have to cut the head or the legs off the person in order to make it fit the space available.
You can set the width and height of the image to a value that you think is best (or a max-height) but you would need to add object-fit:cover
to the image so that it maintains its aspect ratio. This will result in the image filling the space but either the width of the height will be cropped in order for it to fit. If its a landscape image it may not make much difference but if it was a picture of a person you may lose the head, legs or the arms in the photo.
To see the whole image you could apply object-fit:contain
to the image which ensures that the whole image is available within the space that you require but of course will not fill the whole space as either width or length will have a gap at the edges unless the space available happens to be the exact same aspect ratio as the image (very unlikely).
So to answer your question yes you can limit the height of the image but you will need to use one of the methods above. I should point out this is not a css issue as such but simply that real world things have fixed aspect ratios that need t be maintained if you want them to look real 
Sorry for the long winded answer but its a question that gets asked often.