I actually want to automate some tasks such as cropping(not just rectangular) , making background(not the whole photo) darker etc.Actually I just want more advanced thing.

consider a situation " I have 1000 photographs of models with different pose , angle etc. I want to make the color of the lips red in all photographs whenever I see that the dress wore by the model is reddish .if the dress is black make the eye color black. if these criteria are not met , do nothing".

Another example " I have another set of 1000 photographs. I just want to crop each face from each photograph .if a photo has 3 faces they should be cropped . if it has 5 then all 5. it should not crop legs or other parts ".

Is there any program that exists already ? if it doesn't , How about making such a software.I know it's not an easy task !! but how to proceed for that. Can image processing libraries like Magick++ help in making such software ? Also how much time it will take if it is made from scratch(of course using libraries) ? 6 months? 1 year? or more?