Create multiple images on a canvas at once?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
juman
Posts: 6
Joined: 2017-10-22T11:08:36-07:00
Authentication code: 1151

Create multiple images on a canvas at once?

Post by juman » 2017-10-23T00:01:12-07:00

I'm trying to generate one image by creating multiple images in one command and placing them on a canvas.

So in short what I want to do is define a white background area, create another image and position that on the background and then create another image and then place that on the background and then flatten the whole image and save as one.

So I thought this would work :

Code: Select all

convert -size 4500x4500 xc:white \( -size 400x400 xc:red \) -geometry +500+900 \( -size 400x400 xc:blue -rotate 45 \) -geometry +200+200 -layers flatten a_new.png
In the final result I only see the blue square and it is not positioned at +200+200. Only using the first parentheses I get the red square but not in the right position. Any ideas one what I am missing?

snibgo
Posts: 9378
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Create multiple images on a canvas at once?

Post by snibgo » 2017-10-23T00:27:29-07:00

To position images, "-layers" uses page settings, not geometry.

When using "-geometry", you should do a "-composite" after each geometry.
snibgo's IM pages: im.snibgo.com

juman
Posts: 6
Joined: 2017-10-22T11:08:36-07:00
Authentication code: 1151

Re: Create multiple images on a canvas at once?

Post by juman » 2017-10-23T00:42:11-07:00

I tried changing geomtry to page instead and now it moved the blue one. But the red one still doesn't appear?

snibgo
Posts: 9378
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Create multiple images on a canvas at once?

Post by snibgo » 2017-10-23T00:56:35-07:00

Use "-repage", not "-page", and put that within the parentheses, like this (bash syntax):

Code: Select all

convert -size 4500x4500 xc:white \( -size 400x400 xc:red -repage +500+900 \)
 \( -size 400x400 xc:blue -rotate 45 -repage +200+200 \) -layers merge x.png
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 22080
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Create multiple images on a canvas at once?

Post by fmw42 » 2017-10-23T10:26:28-07:00

Please do not post multiple times with the same question.

Post Reply