If you beat a master rank contest and have a score of at least 800, (Don't ask me how you get a score like this) the painter will come out after the contest and say that your pokemon's appeals were so good that it "inspired" him to do a different painting of it than usual.
Then, he asks you if you want it in the art gallery, and if you say yes, the picture gets put in the upstairs of the art gallery.
You can get five paintings in there, one for each contest. Once you get all of them, you get an extra star on your trainer card, and you get a glass statue thing for your secret base.

I hope you can understand this post, as I'm not too good at explaining things. O_O