adding css classes into a specific image field
As of Drupal 8.2

function MYTHEME_preprocess_field(&amp;$vars) {
  if ($vars['element']['#field_name'] == 'field_news_images') {
    foreach($vars['items'] as $key =&gt; $item){
      $vars['items'][ $key ]['content']['#item_attributes']['class'][] = 'thumbnail';
    }
  }
}