How to prepare renderable array for images that are not stored in public or private filesystem, but are delivered statically with module? I have a piece of code that prepares renderable array for my images:

if( !empty($row['image_file_id'])) {
  $row['thumbnail'] = array(
    '#theme' =&gt; 'image_style',
    '#path' =&gt; _mymodule_uri_by_id((integer)$row['image_file_id']),
    '#style_name' =&gt; 'product_thumbnail_small',
    '#attributes' =&gt; array(
      'alt' =&gt; $row['image_alt'],
      'title' =&gt; $row['image_title'],
    ),
  );
}


It works OK:



But I want to add else with image provided within a module. I still want this image to go thorough all image style processing etc. I want my theming colleagues to be able to simply not care if they'll ever decide to add some effects or change resolution. But of course this image is in module directory, not in public://. And it means this will not work:

else {
  $row['thumbnail'] = array(
    '#theme' =&gt; 'image_style',
    '#path' =&gt; drupal_get_path('module', 'mymodule') . '/frontend/noimage.png',
    '#style_name' =&gt; 'product_thumbnail_small',
    '#attributes' =&gt; array(
      'alt' =&gt; 'some universal stub',
      'title' =&gt; 'some universal stub',
    ),
  );
}


It gives:



And browser tries to read that image from http://example.com/sites/default/files/styles/product_thumbnail_small/public//sites/default/modules/mymodule/frontend/noimage.png?itok=-yYlM4ns

This gives nothing (status reports says "access denied"), unless I manually place image in public://sites/default/modules/mymodule/frontend - but I don't want it to be in public file system, I want it to stay in module space. How can I make it work?
Simply put...you can't, unfortunately (well not without changing some core stuff at least)

From the comments for theme_image_style()


  This function does not work with images outside the files directory nor with remotely hosted images.