How can I render a responsive image style from an image in the theme directory? I am working on template views-view-fields--myview.html.twig. But I do 
not think it matters what template you are working with for this to 
work.

I found this Twig that can add Drupal responsive images to an 
image that is not in a field. In this case this image is in the files 
directory. My question is that I want to place this image in my themes 
directory in: /themes/custom/mytheme/img/mygraphic.png. What URI can I 
use to make that work in this example?

Second question is: The 
image alt tag is empty even though I provided one. How can I display an 
alt tag?

{% set responsiveimagestyle = {
    '#theme': 'responsive_image',
    '#responsive_image_style_id': 'my_custom_responsive_style',
    '#uri': 'public://mygraphic.png',
    '#alt': 'my alt text',
    '#attributes': { class: 'img-responsive' },
} %}


In the views-view-fields--myview.html.twig template I now can use the following 
variable.

{{ responsiveimagestyle }}


The image is wrapped in the picture tag and is using the Drupal Responsive Images style.
This is the same when using the image filters from the Twig Tweak
  module: You can't render responsive images from a random URI, it has
  to be an URI that is stored in the file_managed DB table. But with
  Twig tweak you can render normal image styles from random URIs, and
  manually create a responsive image tag by rendering multiple normal
  image styles. – Hudri


Great, so there is a workaround one can do, manually create one:

{% set imagePath = '/themes/custom/mytheme/img/mygraphic.png' %}
&lt;img srcset="{{ imagePath|image_style('thumbnail') }} 300w, {{ imagePath|image_style('medium') }} 800w" src="{{ file_url(imagePath) }}" alt="some graphic image" typeof="foaf:Image"/&gt;