Use pattern image that is repeat image instead background color

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
atf4_solace
Posts: 18
Joined: 2017-09-15T07:57:03-07:00
Authentication code: 1151

Use pattern image that is repeat image instead background color

Post by atf4_solace »

Hello Team,

We are using the Version: ImageMagick 6.9.3-8 Q16 x86_64 2018-06-20 and Platform is LINUX and API is PHP using exec() function.

We have created the image. We are facing the problem for adding the pattern image as background color
we have implemented below frame with single convert command.

In below screenshot, I have explained the where we need to add the pattern image.
Please see screenshot: http://prntscr.com/mjz4kv

Below is the command segment

Code: Select all

-border 2.5x2.5 -background '#7d845c' -extent 825x1125+0+0 -bordercolor '#FEFEFA' -border 2.5x2.5
We need to add pattern image instead -background '#7d845c' this settings option

Our question is how can we use pattern image instead of background color as shown for pink color in the screenshot.

We have checked with texture setting but it is for montage command but how to do it in our single convert command.

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

Re: Use pattern image that is repeat image instead background color

Post by snibgo »

Please link to a sample pattern image.

If you want to replicate that image over the required area, simply tile it, like this:

Code: Select all

convert -size 400x600 xc: -tile rose: -draw "color 0,0 reset" out.png
Use your image instead of "rose:". Then composite anything over the result.

If you want to rotate the pattern image on the four sides, and mitre the corners, this is possible but more complex.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Use pattern image that is repeat image instead background color

Post by fmw42 »

I do not know if this is relevant, since you did not provide an example, but see my bash unix shell script, tileimage, at my link below. Regular tiling can be done using -tile as per snibgo's suggestion.
Post Reply