Good Morning to all out there,
i am new on this board and i hope you guys can help me with some advice.
I am working on a solution to add a pattern to a image what is only in b/w. This pattern must be placed on the black color.
At the moment we do this all in Photoshop and there it is realy easy but i have no idea if it is possible to do it in IM.
So here is my Workflow from Photoshop. Maybe some one of you can help me to make this possible in IM.
1- Load the Image (Bitmap)
2 - Change the Image to Grayscale (Image -> Mode -> Grayscale (proportion: 1)
3 - Select the color black (Modify -> Color Range -> Select the Color)
4 - Contract the Selection (Modify -> Modify -> Contract -> 2Px)
5 - Fill the selection with the pattern (Edit -> Fill -> Pattern) The pattern is also in B/W
6 - Chage the Image to Bitmap (Image -> Mode -> Bitmap) Input res. == Output Res
7 - Save the image
Thanks a lot.
Bit
Add a pattern to a b/w image
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Add a pattern to a b/w image
This should be achievable in IM. What do you mean by contract the image 2px. Does that mean remove a two pixel border or resize the image so that its dimensions are W-2 x H-2? What does modify the color range mean? Exactly how do you want to modify it? What pattern are you trying to use. IM only has certain prebuilt patterns, but perhaps some other patterns can be generated through other IM commands.
Can you post a link to your input images and the PS output image? Then we can probably come up with the commands you need. You can post on any free image hosting service and put links to your images here.
What version of IM and platform are you using?
Can you post a link to your input images and the PS output image? Then we can probably come up with the commands you need. You can post on any free image hosting service and put links to your images here.
What version of IM and platform are you using?
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: Add a pattern to a b/w image
I don't know how or if ImageMagick supports selections, but the same effect can be achieved by using your source image as a mask or alpha channel. Step 4 is the more difficult one. Seeing a typical source image would help in giving you the easiest solution. I have used a blur then threshold in the past, but my input mask was simple (bitmap, connected, convet, etc). For step 5, you would have to provide the pattern (tiled?) if IM doesn't have something close enough built in.
I think he is trying to reduce the area of the selection mask, not the image canvas.fmw42 wrote:What do you mean by contract the image 2px.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Add a pattern to a b/w image
Yes, the equivalent of selections in IM is masks. For shrinking or expanding, the morphology operators are very useful. For some cases, blur and threshold works well.
snibgo's IM pages: im.snibgo.com
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: Add a pattern to a b/w image
I took a look at morphology. It looks like a clean and simple solution to: 4 - Contract the Selection. My blur then threshold trick was really just a special case of the more general convolution approach.