How to replace large, original images used for image caching?
hook the image while finishing the upload process, then compress the size is a good Drupal approach much better than another batch job since the project can be managed in a good scope.

If it is a once-off task, script batch job is fast and efficiency but regarding the daily normal usage, a module is more preferable.

There is a module ImageAPI Optimize (or Image Optimize) 

BTW, the theory could be:

Something like the following may be what you need:

function MYMODULE_node_insert($node) {


// See if a file has been added
  if ($file_items = field_get_items('node', $node, 'field_file')) {
    // Get the first file item
    $file_item = array_shift($file_items);

// Load the file object from the cache/database
$file = file_load($file_item['fid']);

// The path to the file is in $file-&gt;uri
do_something_with($file-&gt;uri);


}
}

REF: https://api.drupal.org/api/drupal/includes%21file.inc/group/file/7