pass custom variable for image field from preprocess node to twig
I found that I have to use the mytheme_preprocess_field hook.

function mytheme_preprocess_field(&amp;$variables) {
  if ($variables['field_name'] == "field_picture") {
    foreach ($variables['items'] as $key =&gt; $item) {
      $grid_class = "grid-item--width1 grid-item--height1";
      $variables['items'][ $key ]['grid_class'] = $grid_class;
    }
  }
}