The "bird of joy" and of good omen, brings joy, often married bliss. Its call heralds good news or the arrival of a guest. "Two magpies" was pronounced the same as "two happinesses," so a painting of two magpies was a pictorial metaphor for double happiness and thus an appropriate subject for a painting to be given to someone to express congratulations, especially for a wedding.
The myth also has it that if a man and a wife had to separate for a while they would brake a mirror and take a half each. If the woman succumbed to other men in the meantime, her half would turn into a magpie and fly back to her husband.
During the Qing dynasty (1644-1912) China was occupied by and run by the Manchus. They practised shamanism, a shaman (the only Manchu loan-word in fairly common usage in English) being someone believed to be capable of traveling to, communicating with and influencing the spirit world. The Manchus continued this practice after their conquest of China, claiming descent from an ancestor born after his mother held a fruit dropped from the mouth of a sacred magpie.
In the Kunning gong (a former residence of the empresses of the Chinese Ming dynasty), a kitchen was installed for the preparation of sacrificial offerings of meat, and spirit poles were erected to hoist up the offerings for the magpies that roosted in the trees of the Forbidden City.
See also: BirdA