Overlay a user defined pattern?

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
pash
Posts: 8
Joined: 2011-04-26T07:59:16-07:00
Authentication code: 8675308

Overlay a user defined pattern?

Post by pash »

Hi,

searched the forum but didn't find a solution.
How do I overlay a user defined pattern like dots, or stripes on an image to produce a output like this with black dots:

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

Re: Overlay a user defined pattern?

Post by fmw42 »

pash wrote:Hi,

searched the forum but didn't find a solution.
How do I overlay a user defined pattern like dots, or stripes on an image to produce a output like this with black dots:

Image

It would be best to provide links to the original picture and the pattern picture. But assuming you already have a pattern image as black/white, try

convert backgroundimage patternimage -compose multiply -composite resultimage

also see ordered dither at http://www.imagemagick.org/Usage/quanti ... red-dither

also you might like to look at my scripts, grid and screeneffects, at the link below.
pash
Posts: 8
Joined: 2011-04-26T07:59:16-07:00
Authentication code: 8675308

Re: Overlay a user defined pattern?

Post by pash »

Thank you.

Here the before image:

http://image-upload.de/image/hyVAYB/fac28b7080.png

Image here-> Image

and the pattern (dot):

http://image-upload.de/image/x0Nfrr/d1d51700f5.png

Image here -> Image

Thank you for your link to your scripts, I will look at them. :O)

PS: I just thougt that there maybe an option to pass an image and a pattern to imagemagick and they will be combined (overlayed)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Overlay a user defined pattern?

Post by fmw42 »

this is the easiest way as long as your pattern has transparency. just tile it over your other image. see http://www.imagemagick.org/Usage/compose/#tile

composite -tile d1d51700f5.png fac28b7080.png result.png
Post Reply