I am facing a though challange - I need to perform repetitive Image formating. Firstly, I need resize picture A so that it has some fixed width in pixels. Then, I need to place picture A in the middle of picture B. I need to perform this task repetitively for hundreds of images. Is there any way to script this, so that I can just type in for example:

perform pictureA.png pictureB.png output.png

Any help is more than welcome!


ImageMagick is a set of command-line tools that can do the sort of things you describe. For example, this command line will overlay picture B with a centered copy of picture A, resized to 100 pixels wide (keeping aspect ratio):

convert pictureB.png ( pictureA.png -resize 100 ) -gravity center -composite output.png

See the ImageMagick docs for more info about its command lines are structured...it's a powerful piece of software, but it takes a bit of work to get the hang of how to use it.

| improve this answer | |
  • 1
    $\begingroup$ Just out of curiosity didnt we agree that software recommendations are offtopic? I dont nesseserily mind but... $\endgroup$ – joojaa Jan 24 '16 at 1:21
  • 1
    $\begingroup$ @joojaa The question is about using scripting to automate image operations, which seems on-topic and generally useful to me. Moreover I don't think I should hold back my answer just because it refers to some external software. $\endgroup$ – Nathan Reed Jan 24 '16 at 3:04
  • $\begingroup$ Love you man. You saved so much of my time :) Hope you have a great day! $\endgroup$ – uksz Jan 24 '16 at 8:27
  • 1
    $\begingroup$ No thats not nesseserily what im saying, im just pointing out that have closed questions of simililar nature due to them being software recommendations. $\endgroup$ – joojaa Jan 24 '16 at 8:40
  • $\begingroup$ The question is about a scripting tool, perhaps making it an "API recommendation" question? It would probably be at home in game development. Maybe I've got a meta meta question here - can questions be recommended for transfer to or crossposted on other stack exchange sites? $\endgroup$ – Daniel M Gessel Jan 26 '16 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.