Turns out I solved my own question with help from a colleague. The two filters that get called after media is uploaded or when media is being edited are; ‘add_attachment’ and ‘edit_attachment’. Here is the code I am using, I then check to see if the attachment is an image (code omitted from example).
function analyse_attachment($attachment_ID)
{
$attachment = get_attached_file($attachment_ID); // Gets path to attachment
update_post_meta($attachment_ID, "image_rgb", $the_colour);
}
add_action("add_attachment", 'analyse_attachment');
add_action("edit_attachment", 'analyse_attachment');
Obviously I’ve omitted some stuff that isn’t relevant to the question. But that code gets called right after you’ve uploaded or edited an attachment.