Here is a small code example of how to get image dimensions from a specific image style.
The code will load the image and image style, it will get the original file dimensions and use image style transformDimensions()
to get its dimensions. It is helpful if you need to know the new image style dimensions of specific image (it can be dynamic when image style calculates one size).
$image = \Drupal::service('image.factory')->get($file->getFileUri());
$image_style = \Drupal\image\Entity\ImageStyle::load('image_style_id');
// Set source image dimensions.
$dimensions = [
'width' => $image->getWidth(),
'height' => $image->getHeight(),
];
// After calling this, the $dimensions array will contain new dimensions.
$image_style->transformDimensions($dimensions, $file->getFileUri());