hook_file_download and style images
Disclaimer - Use this method at your own risk, it has security implications if you don't set up and test it properly :)

A quick and dirty way to override that functionality would be to implement hook_module_implements_alter(), remove the image module's implementation of hook_file_download(), and then implement your own version which has the desired logic. e.g.

function MYMODULE_module_implements_alter(&amp;$implementations, $hook) {
  if ($hook == 'file_download') {
    unset($implementations['image']);
  }
}

function MYMODULE_file_download($uri) {
  // Copy the code from image_file_download() and alter as required.
}