<p><a href="http://www.imagemagick.org">ImageMagick</a> 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):</p>

<pre><code>convert pictureB.png ( pictureA.png -resize 100 ) -gravity center -composite output.png
</code></pre>

<p>See <a href="http://www.imagemagick.org/script/command-line-processing.php">the ImageMagick docs</a> 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.</p>

CC BY-SA 3.0
2016-01-24T01:21:46.423Z
Just out of curiosity didnt we agree that [software recommendations are offtopic](http://computergraphics.stackexchange.com/help/on-topic)? I dont nesseserily mind but...
joojaa
CC BY-SA 3.0
2016-01-24T03:04:22.223Z
@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.
Nathan Reed
CC BY-SA 3.0
2016-01-24T08:27:08.883Z
Love you man. You saved so much of my time :) Hope you have a great day!
uksz
CC BY-SA 3.0
2016-01-24T08:40:07.400Z
No thats not nesseserily what im saying, im just pointing out that have closed questions of simililar nature due to them being software recommendations.
joojaa
CC BY-SA 3.0
2016-01-23T23:59:51.367Z
2016-01-23T23:59:51.367Z
Nathan Reed
<p>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:</p>

<pre><code>perform pictureA.png pictureB.png output.png
</code></pre>

<p>Any help is more than welcome!</p>

<transformations><image>
Is there a way to script image creation?
uksz
# Is there a way to script image creation?

(Asked by: username_0 on 2016-01-23)

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!

**Tags:** transformations, image


---

## 1 answers

### Answer by username_1 on 2016-01-23. Score: 7 | Accepted answer

[ImageMagick](http://www.imagemagick.org) 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](http://www.imagemagick.org/script/command-line-processing.php) 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.

> **Comments:**
> **username_2**: Just out of curiosity didnt we agree that [software recommendations are offtopic](http://computergraphics.stackexchange.com/help/on-topic)? I dont nesseserily mind but...  
> **username_1**: @username_2 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.  
> **username_0**: Love you man. You saved so much of my time :) Hope you have a great day!  
> **username_2**: No thats not nesseserily what im saying, im just pointing out that have closed questions of simililar nature due to them being software recommendations.  

---

