Drupal - How to bulk update image alt and title?

The basic logic goes like this:

$nodes = entity_load('node', FALSE, array('type' => 'the_type'));

foreach ($nodes as $node) {
  $node->field_image[$node->language][0]['alt'] = $node->title;
  $node->field_image[$node->language][0]['title'] = $node->title;

  node_save($node);
}

You should probably split that up into a batch job if you have a lot of nodes.

I'm also pretty sure you could make a quicker solution using VBO and some custom PHP but I don't have time to flesh that out right now.