If you're seeing too much vertical margin, it means your target height is larger than necessary relative to the width, based on the image's aspect ratio.
Instead of hardcoding both width and height, only set the width, and compute the height dynamically.
This way, the image will fill the target area without leaving vertical margins because the aspect ratio is preserved without oversizing.
If you want the image to completely fill the target width and height without any margins, and you're OK with cropping.
This will fill the container and cut off overflow (useful for thumbnails, banners, etc.).