Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
It is confirmed that the Prophet (Sallallahu Alaihi wa Sallam) said: "The angels do not enter a house in which there is a dog or a portrait.” [Reported by Bukhari and Muslim]
He also said: "Every sculpture or portrait maker is in the Hellfire.” [Reported by Muslim]
He also said: "On the Day of Judgement, the people who are severely punished are the sculpturers and portrait makers.” [Reported by Bukhari and Muslim]
It is also confirmed that he cursed the sculpturers and portrait makers, as it is reported in Bukhari.
These Ahadith are crystal clear that sculpturing, and portrait making as well as keeping them is Haram.
Al-Nawawi and Qurtubi said that this is the most preponderant opinion.
However, the people of knowledge differed about the photographic pictures whether they are included in the meaning of these Hadiths or not.
Some of them said that these Ahadith do not apply to them, because the reason of the prohibition is the similarity to the creation of Allah, and photographic pictures are not about the similarity to the creation of Allah, therefore they are permissible.
However, some of the people of knowledge are of the view that the general meaning of the Hadiths encompasses photographic pictures. The reason is that they are not prohibited because of the likeness to the creation of Allah. One of the reasons of the prohibition is the imitation of the Kuffar, the glorification of sculptures, portraits and pictures, exaggeration, and the non-entrance of the angels to houses where there is a portrait, sculpture or picture of living creatures.
Therefore, one should be careful and cautious about the pictures that a person does not need, because he is not safe from doubt and suspicion.
But what a person needs for an I.D card, or a driving license, is permissible according to all scholars because of necessity.
Allah knows best.