Siriusly, magic.
Otherwise, consider it a reflection of that moment. It's not the headmaster, it's the portrait of a headmaster. It vividly and actively portrays the headmaster in question, but it isn't them. Like an advanced LLM recreating a personality by copying their social media content.