Facebook, the leading social networking site in the world, has spent $1bn to buy a smartphone app called Instagram which allows users to edit and share photos online.