set maximum length to image title
Something like this may work:

/**
 * Implements hook_field_widget_form_alter
 */
function mymodule_field_widget_form_alter(&amp;$element, &amp;$form_state, $context) {
  if ($context['field']['type'] == 'image' &amp;&amp; $context['instance']['widget']['type'] == 'image_image' &amp;&amp; !empty($context['instance']['settings']['title_field'])) {
    foreach (element_children($element) as $delta) {
      $element[$delta]['#process'][] = 'mymodule_image_field_widget_process';
    }
  }
}

/**
 * Image field process callback
 */
function mymodule_image_field_widget_process($element, &amp;$form_state, $form) {
  // Set title maxlength, if accessible
  $maxlength = variable_get('imagefield_maxlength', 40);
  if ($element['title']['#access']) {
    $element['title']['#maxlength'] = $maxlength;
  }

  return $element;
}