Drupal can't create image styles for files located in theme directory I have an image located in sites/all/themes/mytheme/images directory. 
I'm displaying it programmatically with attached image style like:

  $style =  array(
    'style_name' =&gt; 'my_style',
    'path' =&gt; drupal_get_path('theme', 'mytheme') . '/images/' . $filename,
    'width' =&gt; 30,
    'height' =&gt; 30,
    'alt' =&gt; $alt,
    'title' =&gt; $title,
  );

  return theme('image_style', $style);


First error: 404:


  "NetworkError: 404 Not Found -
  http://j.dev/sites/default/files/styles/my_style/public/sites/all/themes/mytheme/images/img.png?itok=qsTbAc8I"


Log report:


  Source image at public://sites/all/themes/mytheme/images/img.png not
  found while trying to generate derivative image at
  public://styles/my_style/public/sites/all/themes/mytheme/images/img.png.


I'm sure that img.png exists in sites/all/themes/mytheme/images

File permissions:


sites/all/themes/mytheme/images: 777
sites/default/files/styles/my_style: 777
core module Image Style allow only images from 

public:// file system (sites/default/files).

For using image styles with any other images, you should install the Imagecache External module.


  Imagecache External is a utility module that allows you to store external images on your server and apply your own imagecache (D6) / Image Styles (D7).