Display particular Image Style for image based on Role of User? Using ImageCache Actions there are 2 different Image Styles - e.g. S1 and S2. 

What needs to happen: 


User A has Role Y and when s/he views a node/user profile should always be presented with S1 images. 
User B has Role Z and when s/he views a node/user profile should always be presented with S2 images. 


What are the different ways this can be achieved? All suggestions very welcome.
You can use a hook_preprocess_image_style to alter the style name to use:

/**
 * Implements hook_preprocess_HOOK for theme image_style.
 */
 function mymodule_preprocess_image_style(&amp;$variables) {
   $style = mymodule_determine_style_to_use($variables);
   $variables['style_name'] = $style;
 }


Take care that you do not alter all image styles, but only those you want/need to change, so mymodule_determine_style_to_use() should e.g have a check on $variables['style_name'] being S1 or S2.