To Retrieve Media Images Roles type from the Product in Magento 2 is useful to know each image role whether its small_image, thumbnail, or swatch image.
When you create a product, you need to assigned roles based on its display position.
The Base Role will be displayed on the product detail page.
A small Role will be displayed on the category listing page.
The ThumbnailRole will be displayed on the Shopping Cart page.
Swatch imageRole will be displayed on the product swatches.
