You only need one of height or width. The browser will calculate the other dimension automatically.
Of course, you can take it upon yourself to calc the other dimension. But, if you get it wrong, the image will be distorted.
The preview of the image before posting lets me know whether the picture is distorted or not. So I make the incremental adjustments of the size after seeing what side of it is off. I learned HTML 3.2 nearly 20 years ago and I’ve not kept up with the other versions. So I always add height and width dimensions and I use quote marks for everything. Thanks!