You need to get image style in paragraph preprocess hook:
use Drupal\Core\Entity\Entity\EntityViewDisplay;
function Mymodulename_preprocess_paragraph(&$vars) {
$component = EntityViewDisplay::load('paragraph.sing.default')->getComponent('field_img');
$image_style = $component['settings']['image_style'];
$vars['img_style'] = $image_style;
}
Note: In this paragraph.sing.default:
paragraph denotes: paragraph entity,
sing denotes: machine name of paragraph,
default denotes: view mode
Then need to add following snippet code in override paragraph.html.twig as per drupal standard
{% set image = {
'#theme': 'image_style',
'#style_name': img_style,
'#uri': paragraph.field_img.0.entity.uri.value,
'#alt': paragraph.field_img.0.alt,
'#attributes': { class: img_style },
}
%}
{# now print the image style, it display image with respective img style configured from mange display. #}
<div>{{ image }}</div>
Note: Here you can see img_style variable set in paragraph preprocess hook because field format display options are components of view modes, stored in the config entity EntityViewDisplay, that can not be accessed from field in paragraph twig directly.
So to fetch the value of image style configured in manage display at the backend , added paragraph hook.