From the Super Mario Wiki
Ads keep the MarioWiki independent and free :)
Mario's Painting is a painting enclosing Mario in it without a way to escape (though one could use the Ghost Portrificationizer or Dark-Light Device) in Luigi's Mansion and Luigi's Mansion: Dark Moon. King Boo owns Mario's Painting until he is captured.
In Luigi's Mansion, King Boo sends Mario and Luigi an invitation to Luigi's new house. Mario arrives first in an attempt to welcome Luigi, only to be caught by Boos while walking in. King Boo traps Mario in the painting and rests in the Storage Room until Luigi releases him and his minions. Upon being released, King Boo watched over Mario in the Secret Altar, hoping no one rescues Mario and to trap Luigi as well. Upon Luigi's arrival at the altar, King Boo turns Mario into Bowser, which inhales Luigi inside.
After Luigi captures King Boo, he escapes the painting, grabs Mario, and heads to the lab. Using the Ghost Portrificationizer, he reverts Mario back to normal (but in a rather comical way).
Luigi's Mansion: Dark Moon
After destroying the Dark Moon, King Boo captures Mario once more, but puts him in a "still-image" painting instead, so he wouldn't listen to Mario crying for help. Mario remains this way until Luigi reverts him back using the Dark-Light Device, where he thanks him and calls him "Number 1".
Throughout Luigi's Mansion: Dark Moon, the Security Images show part of Mario's painting in a sack guarded by Boos. In the Haunted Towers (B-4) and Secret Mine (D-2), his shoes are seen, and in the Old Clockworks (3-Boss), his hat is seen. The Treacherous Mansion exposes Mario's full painting (E-3).