Page 1 of 1

appendImages into rows and columns

Posted: 2015-05-12T11:21:41-07:00
by Zelf
I am not using exec command in php so I don't have access to run something like the following from the manual at: http://www.imagemagick.org/Usage/layers/ where it states, "You can take this further to make a whole array of images, and build them either by rows, or by columns."

Code: Select all

convert \( font_1.gif font_2.gif font_3.gif +append \) \
          \( font_4.gif font_5.gif font_6.gif +append \) \
          \( font_7.gif font_8.gif font_9.gif +append \) \
          \( -size 32x32 xc:none  font_0.gif +append \) \
          -background none -append   append_array.gif
Using the http://php.net/manual/en/imagick.appendimages.php appendImages function in imagick how can I simulate the seemingly more robust append CLI command? Or is it not possible.

I would love to be able to create an array in php like the following, loop through it, and each new row somehow tell appendImages when it should start a new row before combining images. Any ideas on how to solve this?

Code: Select all

$rack = [
            'row1' => [
                'image1.jpg',
                'image2.jpg'
            ],
            'row2' => [
                'image3.jpg',
                'image4.jpg'
            ]
        ];

Re: appendImages into rows and columns

Posted: 2015-05-13T05:08:04-07:00
by Bonzo
I think this is a php problem not an IM one and I would post in a php forum.

I would think you need to loop through your array creating and executing the Imagick code as you go.

Re: appendImages into rows and columns

Posted: 2015-05-13T09:00:17-07:00
by Zelf
This is a question about the php imagick extension and the imagick appendImages function. How is this not relevant to the php imagick extension programming interface forum?

Re: appendImages into rows and columns

Posted: 2015-05-13T09:09:37-07:00
by fmw42
Zelf wrote:This is a question about the php imagick extension and the imagick appendImages function. How is this not relevant to the php imagick extension programming interface forum?
I think Bonzo means that it is about PHP looping over the Imagick code. So he is saying to find a PHP forum about looping.

Re: appendImages into rows and columns

Posted: 2015-05-13T09:15:50-07:00
by Zelf
My question is regarding the appendImages function, not looping. I know how to loop in php, haha!

Here's my question again: When I call appendImages is it possible to somehow tell this function to start a new row. E.g. if I'm looping through my images and I call appendImages(false) - so stacking from left to right - how can I tell appendImages to start a new row say after 3 images?

In ImageMagick from CLI I can set row boundaries with (), how do I mimick this behavior with imagick's implementation of appendImages?

Code: Select all

convert \( font_1.gif font_2.gif font_3.gif +append \) \
          \( font_4.gif font_5.gif font_6.gif +append \) \
          \( font_7.gif font_8.gif font_9.gif +append \) \
          \( -size 32x32 xc:none  font_0.gif +append \) \
          -background none -append   append_array.gif

Re: appendImages into rows and columns

Posted: 2015-05-13T09:34:49-07:00
by fmw42
Here's my question again: When I call appendImages is it possible to somehow tell this function to start a new row
Not that I know about, not even in command line mode. That only can be done using montage in command line mode or PHP exec. See http://www.imagemagick.org/Usage/montage/

Re: appendImages into rows and columns

Posted: 2015-05-13T13:16:44-07:00
by Bonzo
You could try posting on the forum on this site: http://www.phpimagick.com/ or write some php code to loop over the array as I suggested.

Re: appendImages into rows and columns

Posted: 2017-09-11T21:00:16-07:00
by fmw42
The only way to start a new row is to +append image horizontally into rows. Then -append the row images vertically into your final set of rows and columns. But I think you know that already. To create rows and columns see the montage function. See http://us3.php.net/manual/en/imagick.montageimage.php