Page 1 of 1

fill with tile:Image.png - retain Transparent Background

Posted: 2013-11-01T16:22:45-07:00
by whidbeyeagle
What is the easiest way to fill a opaque color area of an image that has a transparent background with a tile:Image.png and retain the transparent background.
I have no problem using convert fill to change the area to any color.
Also I can convert tile:Image.png compose and composite but that fills in the transparent background.
I have also tried doing with a mask without success.
Thank you
Wayne

Re: fill with tile:Image.png - retain Transparent Background

Posted: 2013-11-01T16:47:33-07:00
by fmw42
One way is to tile out a new image of the size of the area you want to replace, then composite the tiled image over that region (assuming you are talking about a rectangular area.

If might be helpful to see the image you want to start with in order to understand your problem better.

Also please identify your IM version and platform.

Re: fill with tile:Image.png - retain Transparent Background

Posted: 2013-11-02T13:43:39-07:00
by whidbeyeagle
I am using Version: ImageMagick 6.8.4-8 2013-04-09 Q16
My base image has a transparent background
Image

I would like to replace the black with this swatch image below and retain the transparent background and tile the image to fit if needed

Image

I am not able to create the mask needed in IM so the one you see below I created manually

Image

I am able to execute the following command to create my final image below
convert green_swatch_200X200.png base_black_mask2.png -alpha off -compose copy_opacity -composite final_image.png

Image

Re: fill with tile:Image.png - retain Transparent Background

Posted: 2013-11-02T14:13:50-07:00
by fmw42
try this (it extracts the alpha channel from the transparent base image)

convert green_swatch_200X200.png \( base_image.png -alpha extract \) -compose copy_opacity -composite result.png

Re: fill with tile:Image.png - retain Transparent Background

Posted: 2013-11-02T15:05:36-07:00
by whidbeyeagle
Fred
It worked perfect
:D
Thank you very much for the assist

Wayne

Re: fill with tile:Image.png - retain Transparent Background

Posted: 2013-11-02T15:13:47-07:00
by fmw42
If you have a base tile, you do not need to create the tiled image separately. You can combine it all in one command.


convert \( -size 200x200 tile:tree.gif \) \( base_image.png -alpha extract \) -compose copy_opacity -composite show:

Re: fill with tile:Image.png - retain Transparent Background

Posted: 2013-11-02T15:42:24-07:00
by whidbeyeagle
Fred

You are really making my day

8)

Wayne