Appending Images from Left to Right

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
ashfaq1987
Posts: 3
Joined: 2019-02-11T15:28:29-07:00
Authentication code: 1152

Appending Images from Left to Right

Post by ashfaq1987 » 2019-02-11T15:36:29-07:00

Hello,

I am trying to append few images using the below code.

convert image_[1-$#].png -append Page1.png [$# value in the case I am using right now is 5]

But the layout of my result image looks like : image_5<-- image_4 <-- image_3<-- image_2<-- image_1

whereas I want : image_1-->image_2-->image_3-->image_4-->image_5

what am I doing wrong? Why is the layout right to left instead of left to right?

Any ideas?

Version : ImageMagick 6.6.5-8 2011-02-14

Thanks
Ash

User avatar
fmw42
Posts: 24737
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Appending Images from Left to Right

Post by fmw42 » 2019-02-11T16:13:50-07:00

Code: Select all

convert image_[1-5].png -append Page1.png
Does that work properly? If not then your OS may be listing them by date or reverse date rather than alphabetically. If you have more than 9, then you should use leading zeroes if listed alphabetically.


If you want them all, then a better syntax would be to use Imagemagick image sequence numbering.

Code: Select all

convert image_?.png[0--1] -append Page1.png
Image sequence numbers in Imagemagick start with [0]. So if your first images is image_1.png, then that will be what is included. If your first image starts with image_0.png and you only want 1 to the last (-1), then use

Code: Select all

convert image_?.png[1--1] -append Page1.png


IM 6.6.5.8 is so ancient. I recommend that you upgrade immediately. It is over 350 versions old.

ashfaq1987
Posts: 3
Joined: 2019-02-11T15:28:29-07:00
Authentication code: 1152

Re: Appending Images from Left to Right

Post by ashfaq1987 » 2019-02-12T07:43:17-07:00

Thanks much for your reply. It is possible that my OS is listing the files by date. I am accessing the server through a X terminal. I tried all your suggestion but in vain. My images are still combined from Right to left. It's almost like while appending the images are added to existing images left side instead of right side. I have another which I combines vertically in which the bottom image is right justified instead of left justified. Even after using gravity options. I have no admin rights to update Imagemagick.
Thanks
Ash

User avatar
fmw42
Posts: 24737
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Appending Images from Left to Right

Post by fmw42 » 2019-02-12T15:18:52-07:00

try

Code: Select all

convert image_?.png[0--1] -reverse -append Page1.png

ashfaq1987
Posts: 3
Joined: 2019-02-11T15:28:29-07:00
Authentication code: 1152

Re: Appending Images from Left to Right

Post by ashfaq1987 » 2019-02-12T15:22:01-07:00

Thanks I figured out what was wrong. I was stacking them up vertically and rotating them. now I rotate before I stack them horizontally.

Post Reply