Before adding new image sizes, you need to make sure that your theme has support enabled thumbnails. This can be done by adding to yours function.php function:
add_theme_support('post_thumbnails');
Now add a new image size this can be done by pasting in function.php
add_image_size( 'my_new_image_size', 500, 400, true );
my_new_image_size – name for new size (!be careful, there are some reserved names that cannot be used they can be viewed in the documentation);
500 – width for new image size;
400 – height for new image size;
true – crop image. If you want the picture not to be cropped but to remain in its proportions change this to false;
More about function add_image_size()
How to display your image with a new size on WordPress site
March 17, 2022