Q:

image_style_create_derivative not resizing the image

I am using image_style_create_derivative to create image styles on fly.  Before that I am using image_style_path which creates style path. 
$derivative_uri = image_style_path([style_name], [source]);
image_style_create_derivative([style_name], [source], $derivative_uri)

It generates image.  Which is fine.  But it is generating image with original size.  Not with the size of style_name.  
For example if style name is thumbnail, the generated image style size should be 160x100.  
How can I achieve it? 

A:

image_style_create_derivative needs the style passed as array..,
so _ first you need to load the style or fake the array

applying all image effects defined in $style['effects']

see: image_style_create_derivative
i usually use image_style_url like this (if taken from field), otherwise just pass the source. 
        $field = field_view_field('node', $node, $field_name, reset($image), $arr_display);
        if ($img_style) {
          $uri = image_style_url($img_style, $field[0]['#item']['uri']);
        }
        else {
          $uri = file_create_url($field[0]['#item']['uri']);
        }

