Taking a photograph of someone for personal use in public places is not an offence per se but if such photograph is taken in a way that is embarrasing or causing an insecurity to the person being clicked then it may attract legal conquences if ther person takes any legal action.
Taking a random picture where a person happens to appear is not illegal but specifically clicking someone who has given no consent for the same can land one into trouble.
Taking someone’s picture without their consent amounts to invasion of privacy which is one of the fundamental rights and if a person believes that his or her privacy has been invaded by the state by publishing his or her photograph in any way, he or she can file a writ petition under Article 32 before the Supreme Court of India or a High Court under Article 226 for the enforcement of his or her fundamental right to privacy under Article 21 of the Indian Constitution.
However, one can be booked under 345D under Indian Penal Code for stalking, or eve teasing or any other offence if the person being clicked feels apprehensive about the same. Even if one is relieved from these charges, still right to privacy stand higher.
Reference: Section 354D of the Indian Penal Code, 1860
354D. Stalking.–(1) Any man who–
(i) follows a woman and contacts, or attempts to contact such woman to foster personal interaction repeatedly despite a clear indication of disinterest by such woman; or
(ii) monitors the use by a woman of the internet, email or any other form of electronic communication, commits the offence of stalking:
Provided that such conduct shall not amount to stalking if the man who pursued it proves that–
(i) it was pursued for the purpose of preventing or detecting crime and the man accused of stalking had been entrusted with the responsibility of prevention and detection of crime by the State; or
(ii) it was pursued under any law or to comply with any condition or requirement imposed by any person under any law; or
(iii) in the particular circumstances such conduct was reasonable and justified.
(2) Whoever commits the offence of stalking shall be punished on first conviction with imprisonment of either description for a term which may extend to three years, and shall also be liable to fine; and be punished on a second or subsequent conviction, with imprisonment of either description for a term which may extend to five years, and shall also be liable to fine.]