Create colorbox link programmatically
I don't think there is, weirdly enough I've just been looking for pretty much the same thing...I couldn't find one so I just wrote a helper function:

function _lightbox_link($image, $style_name) {
  $image_style = theme('image_style', array(
    'style_name' =&gt; $style_name,
    'path' =&gt; $image['uri'],
    'alt' =&gt; $image['alt']
  ));

  $url = image_style_url($style_name, $image['uri']);

  $link = l($image_style, $url, array(
    'html' =&gt; TRUE,
    'attributes' =&gt; array(
      'rel' =&gt; array('lightbox-gallery')
    )
  ));

  return $link;
}