tile the image out to size 500x18 and then composite it over your background using -gravity center.
see
http://www.imagemagick.org/Usage/canvas/#tile
http://www.imagemagick.org/Usage/compose/
http://www.imagemagick.org/Usage/layers/#convert
so
convert background \( -size 500x18 tile:image2tile \) -gravity center -compose over -composite result
In Windows, leave off the two \
Tile image horizontally over a bckground vertically centered
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Tile image horizontally over a bckground vertically cent
A double backslash is probably because you are using a PHP system call in double quotes.
That API method results in the command being parsed 3 times, PHP, Shell and by IM.
See PHP using Shell Commands, Watch the extra quotes
http://www.imagemagick.org/Usage/api/#php_quotes
That API method results in the command being parsed 3 times, PHP, Shell and by IM.
See PHP using Shell Commands, Watch the extra quotes
http://www.imagemagick.org/Usage/api/#php_quotes
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Tile image horizontally over a bckground vertically cent
I do not believe there is any way to do that automatically in IM6. (IM7 will likely allow that). You will have to extract the background image width in a separate command and then feed that as a variable to the -size $(Width)x18.now i only need to figure out how to tile it for 100% of the destination image (that is the background) width as it is not always 500 px wide
Alternately, make the width larger than any image you want to use. The composite should automatically crop it to fit the background image.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Tile image horizontally over a bckground vertically cent
You can do this in IMv6 by using -distort viewports and virtual pixels to do the tiling..fmw42 wrote:I do not believe there is any way to do that automatically in IM6. (IM7 will likely allow that).now i only need to figure out how to tile it for 100% of the destination image (that is the background) width as it is not always 500 px wide
For example tiling a "rose:" image, across the center of a "logo:" image
Code: Select all
convert logo: -set option:my:width '%[w]' \
\( rose: -set option:distort:viewport '%[my:width]x%[h]' \
-virtual-pixel tile -filter point -distort SRT 0 \) \
-gravity center -composite show:
EXTRA: if you want to 'roll' the tiled image, you can set offsets to the viewport!
IMv7 will eventually allow you to do the tile much more directly...
For example this will eventually work (but doesn't at this time)
Code: Select all
magick logo: rose: -size '%wx%[fx:v.h]' +delete \
tile:rose: -gravity center -composite show:
Also there is plans for proper 'tiling' operator that uses in-memory images!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/