My custom header does not change the header image height and width

You have forgot to do “echo” the Height & Width in Image code. Your Header code should like below.

<img src="https://wordpress.stackexchange.com/questions/348195/<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="">
<?php wp_nav_menu( array('theme_location'  => 'primary') ); ?>

check this reference https://codex.wordpress.org/Custom_Headers