To optimize site performance, WordPress automatically resizes big images.

By default, big images are images with a width or height of more than 2560 pixels.

So images that are larger than 2560 pixels will be scaled down to this maximum size.

However, we can modify this threshold to a different size or completely disable this auto-scaling feature.

For example, the following function will change the threshold to 4000px (instead of 2560):

/**
 * Changes the default threshold of a big image size
 *
 * @param int $threshold - The threshold value in pixels. Default 2560.
 * @return int
 */
function notesontech_custom_big_image_size_threshold( $threshold ) {
	return 4000;
}

add_filter( 'big_image_size_threshold', 'notesontech_custom_big_image_size_threshold', 999, 1 );

And this will completely disable the auto-scaling feature:

// Disable the auto-scaling of big images.
add_filter( 'big_image_size_threshold', '__return_false' );

This PHP code can be added to the functions.php file of the theme or to another theme configuration file if one exists.

References