Even though, as we've seen, we can handle image manipulations programmatically ourselves, typically this is done as part of Image Styles which can be created and configured via the UI. These work similarly to how they did in Drupal 7 and involve the application of several possible Image Effects in order to create image variations used in different places. Drupal 8 comes with the same three default image styles as did Drupal 7:
The image styles themselves are configuration entities that store configuration specific to the ImageEffect plugins they work with. Once they are created in the UI, we can make use of them in various ways. The most typical way is to use the image style in the display configuration of an entity field or even in Views when rendering an image field.
If you remember, in the beginning of the chapter we created the image field on the product entity but we did not configure a display. So for the moment, the imported images do not show up on the main product page. But we can add some display configuration to our base field definition so that images are shown with a specific image style:
->setDisplayOptions('view', array( 'type' => 'image', 'weight' => 10, 'settings' => [ 'image_style' => 'large' ] ))
In this example, we are using the default image field formatter plugin which can be configured to use an image style. So under the settings key, we reference the large image style configuration entity which actually comes with Drupal core. Omitting this would simply just render the original image. Make sure you check back to Chapter 7, Your Own Custom Entity and Plugin Types, and Chapter 9, Custom Fields, if you are a bit fuzzy on the base field definitions.