Can you tell me how to make extension to take a picture without user interaction?

I really need to take a picture automatically, without user interaction.
I don't have any money to pay for it, so decided to make it on my own.
How can I make it?

An open-source extension has already done this (credit @Kumaraswamy):

1 Like