The past tense of take is "took" or "did take," but not "did took." So, you should say, "When did you take this picture?"
"Had taken" is past perfect and is active voice.
"Was taken" is past tense in the passive voice. Since the picture had the action done to it (not the one doing the action), you need to use the passive voice.
"When was this picture taken?"