How to show an image in an image style I'm creating a custom twig for my node 1, as node--1.twig.html. 

In this I'm showing the image uploaded in the node as 

&lt;div class="diversity-image"&gt;
    {{ set image = content.field_main_image|merge({'#style_name': 'header_image'}) }}
    {{ image }}
&lt;/div&gt;


But it is not giving me the image of that image style, header_image. 

How do I do that in twig?
In twig you can only merge the top level of an array. So you need two steps, first get the image from the content array and then overwrite #image_style. 

node.html.twig

{% set image = content.field_image.0 %}
{% set image = image|merge({'#image_style': 'thumbnail'}) %}


You can now display the image a second time in the changed image style:

{{ image }}