The basic moving paintings, like in the great stairwell: The painters infuse magic into them to make them move, make noise, etc. and some even have personality traits. But they're very basic recreations.
The headteacher painting: The subject of the painting infuse the painting with a lot of "themselves" and their magic to basically make a limited copy.
Although as McGonagall says: It's less than half of what they were in life. Which is why they don't actually continue teaching or similar.
Unfortunately it's from The Cursed Child.