Page 1 of 2
Apply texture on selected Area (Color) of an Image
Posted: 2009-08-26T02:28:29-07:00
by sanjeevk
Hi All,
I want to apply one image on the selected area or color of an Image.
for this I have try following :-
composite -blend 70 Rings_0.png HardTwist.png new.png..
This does not give exact result.
any one can help me.
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-26T09:31:21-07:00
by fmw42
please post examples otherwise we have no idea what you mean by "does not give exact results"
please show a good result as well
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-26T20:59:52-07:00
by sanjeevk
Suppose we have an Image that have many color like red, green and white . we can apply texture on the over all image. As giving in the followin example on ImageMagick.
http://www.imagemagick.org/Usage/photos/#texture
In this example texture is apply on whole image. I want to apply this texture only on white color of this image. Please suggest on the same.
Thanks,
Sanjeev Kumar
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-26T21:32:11-07:00
by fmw42
sorry can you show us the texture and what image you want to apply in only the white area. it is not clear what you want.
If I understand and perhaps not, then you need to have a texture image the size of the other image. In the other image you need to mask the white area and make it transparent. Then you can composite the image with the white area made transparent over the background texture image.
If you can provide and example of your texture image and the image you want to put your texture into, then perhaps we can provide the commands to do so.
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-26T21:54:03-07:00
by sanjeevk
Currently I am working on a web base application for on-line color manipulation of an image.
Please click on this link :
http://www.imagemagick.org/Usage/photos/#texture
see this example. In this example texture is added to the all over the Image. I want to apply different texture on the different color of the same image OR we can say that I want to apply texture on only selected color of this image.
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-26T22:00:15-07:00
by fmw42
I will try to work on this tomorrow unless Anthony gets to it tonight. It is about my bedtime.
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-27T10:26:41-07:00
by fmw42
# do same processing as Anthony
# create copy of original with white made transparent
# composite together
convert pagoda_sm.jpg \
\( -clone 0 -size 320x295 tile:texture_fabric.gif \
-compose hardlight -composite \) \
\( -clone 0 -strip -fuzz 10% -transparent white \) \
-delete 0 -compose over -composite pagoda_sm_texture_white.png
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-27T20:55:23-07:00
by sanjeevk
Thanks,
Anthony
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-27T21:24:51-07:00
by anthony
see IM Examples, Photo Handling, Add a Texture to an Image
http://www.imagemagick.org/Usage/photos/#texture
However note that in freds solution the mask was created from the image of just the areas within 10% of white. In your case a separate mask image would be used to limit the area being textured.
Fred, perhaps you should have generated the mask separately. However it is a good addition to add to IM Examples, so I'll see about doing that.
Hmmm now if I can get a GOOD example of say replacing a dress, then I would make it a completely new photo modification section, that follows on from the 'pagoda' example.
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-27T21:31:58-07:00
by sanjeevk
Hi fmw42,
It's work like magick. But when I use it with a transparent .png image in witch only one color strip and rest part of this image is transparent in that case texture is also apply on transparent part of this image.while I want to untouched transparent part of this image.Can you suggest on the same.
Thanks,
Sanjeev Kumar
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-27T21:38:39-07:00
by fmw42
sanjeevk wrote:Thanks,
Anthony
Actually it was fmw42 who made the example
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-27T21:47:08-07:00
by fmw42
anthony wrote:
However note that in freds solution the mask was created from the image of just the areas within 10% of white. In your case a separate mask image would be used to limit the area being textured.
Fred, perhaps you should have generated the mask separately. However it is a good addition to add to IM Examples, so I'll see about doing that.
Sorry I still don't understand his requirement and a lack of supplying his real image just makes it harder.
I am not sure what you meant by generating the mask separately. Perhaps you can supply another solution that would work better. In fact, I would be very interested in seeing if you can repeat my solution (where I change from using composite to convert, so I could make it one command line), but could not figure out how to avoid feeding the size to the tile:textureimage. You were able to avoid that in your original method, but I have searched your pages and all your other examples seem to need the size defined for the texture. Is this a composite only issue or can it carry over to convert.
In fact, I still think IM needs some general way of setting and retrieving an image size in a single command line to avoid a pre-command to find the size and put it into a variable. There are many times when you want to create an gradient: or texture of a given size to match some image in a given command line (not to mention some constant color, although that can be done with a clone and -colorize or -threshold or the like). But I can figure out no way to generate a gradient:, radial-gradient: pattern: or tile to match some image in the one and only command line via a clone of a previous image in the command line. Am I missing something?
Something like:
convert image \
\( -clone -setsize +delete gradient: \) \ ....
Any ideas how to do this now or later?
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-27T21:47:34-07:00
by sanjeevk
Sooooryyy
fmw42
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-27T21:53:58-07:00
by fmw42
sanjeevk wrote:Sooooryyy
fmw42
No problem. Glad to help. But I don't understand your transparency issue. You made no mention of your image having transparency. The obvious but perhaps not best solution is to copy the alpha channel to a separate image, then delete the alpha channel on your image, then add the texture, then compose copy_opacity to add your original alpha channel back at the end.
But you have not provided an real example of your images for us to know your real problems and test any solution. So we are just guessing at this point. At least I am. Perhaps Anthony understands and can provide a better method or one more general.
Re: Apply texture on selected Area (Color) of an Image
Posted: 2009-08-27T22:21:02-07:00
by sanjeevk
HI fmw42,
Use this image.
and run this command
convert aqua_font.png \( -clone 0 -size 66x58 tile:texture_fabric.gif -compose hardlight -composite \) \( -clone 0 -strip -fuzz 10% -transparent \#1D8DF9 \) -delete 0 -compose over -composite aqua_font_texture.png.
see the output.
this command apply texture on whole image. While I want to apply texture only on "A" or only on blue color of this image.
thanks,
sanjeev kumar