using Radial Flare for a mask
using Radial Flare for a mask
Hi all, first post ...
While reading http://www.imagemagick.org/Usage/advanced/#stars , it occurred to me that the first example radial flare would make an excellent mask for a thumb shape (flare_1_final.png). I wasn't sure if it was the right combination of color for a mask, but it appears to work fine using the composite formula given in the examples pages for using a mask: composite -compose CopyOpacity flare_1_final.png +matte \( rose: -resize 100x100! \) out.png. This is fine, but since the mask goes right to the edges it will show an implicit border when using a different color background. How could that radial flare command be modified so that the edges are fully transparent ?
thanks,
Robert
While reading http://www.imagemagick.org/Usage/advanced/#stars , it occurred to me that the first example radial flare would make an excellent mask for a thumb shape (flare_1_final.png). I wasn't sure if it was the right combination of color for a mask, but it appears to work fine using the composite formula given in the examples pages for using a mask: composite -compose CopyOpacity flare_1_final.png +matte \( rose: -resize 100x100! \) out.png. This is fine, but since the mask goes right to the edges it will show an implicit border when using a different color background. How could that radial flare command be modified so that the edges are fully transparent ?
thanks,
Robert
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: using Radial Flare for a mask
if I understand, then simply pad your flare image (mask) with black to be the same size as the image you want to overlay it on. Then when it becomes the alpha channel, the black will become transparent.
see -background black -extent WidthxHeight
http://www.imagemagick.org/Usage/crop/#extent
see -background black -extent WidthxHeight
http://www.imagemagick.org/Usage/crop/#extent
Re: using Radial Flare for a mask
Thanks for your reply. In this case I don't see how that would work. Here is the command from the Usage page:
If you try this command, then use flare_1_final.png as a mask, you will see that because random pixels will get no further than the current edge, it creates an implicit border which will show even when using a transparent background. Because I really don't understand the complexities of this command, I don't see where or even if it is possible to set a larger canvas for the flare to do what I would like.
Robert
Code: Select all
convert -size 100x1 xc: +noise Random -channel G -separate +channel \
-scale 100x100\! \( -size 100x100 gradient: -sigmoidal-contrast 8x50% \) \
-compose hardlight -composite -virtual-pixel HorizontalTileEdge \
-distort Polar -1 flare_1_final.png
Robert
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: using Radial Flare for a mask
I guess I do not understand what it is that you need to do. Can you show an example of your problem?
try this:
convert \( rose: -resize 100x100! \) flare_1_final.png \
\( -clone 1 -threshold -1 -virtual-pixel black -blur 10x65000 -level 50x100% \) \
\( -clone 1 -clone 2 -compose multiply -composite \) \
-delete 1,2 -compose copy_opacity -composite out2.png
try this:
convert \( rose: -resize 100x100! \) flare_1_final.png \
\( -clone 1 -threshold -1 -virtual-pixel black -blur 10x65000 -level 50x100% \) \
\( -clone 1 -clone 2 -compose multiply -composite \) \
-delete 1,2 -compose copy_opacity -composite out2.png
Re: using Radial Flare for a mask
Some interesting results!
Something not quite right though!
I assume you want a "lens flare effect" similar to the second image but retaining the colour?
Something not quite right though!
I assume you want a "lens flare effect" similar to the second image but retaining the colour?
Re: using Radial Flare for a mask
Thanks for your reply. I wanted something like the example I gave using rose: in my 1st post.
So that the image takes the shape of the flare. But what I would like is that the rays of the flare, of varying lengths, NEVER REACH THE EDGE OF THE MASK, and the edges are fully transparent. So that the result is an image that you could seamlessly overlay on any background and you would not see that it is in fact rectangular. You can clearly see that the rose image above is in fact rectangular (100x100) because of the edges. So it is the mask itself which needs adjusting.
Wow I'm having a hard time explaining myself ...
Robert
Code: Select all
composite -compose CopyOpacity flare_1_final.png +matte \( rose: -resize 100x100! \) out.png
So that the image takes the shape of the flare. But what I would like is that the rays of the flare, of varying lengths, NEVER REACH THE EDGE OF THE MASK, and the edges are fully transparent. So that the result is an image that you could seamlessly overlay on any background and you would not see that it is in fact rectangular. You can clearly see that the rose image above is in fact rectangular (100x100) because of the edges. So it is the mask itself which needs adjusting.
Wow I'm having a hard time explaining myself ...
Robert
Last edited by grepper on 2010-04-15T06:26:58-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: using Radial Flare for a mask
something like this:
If so, then I will have to make some mods to my starbrust script to overlay the starburst into the alpha channel rather than simply compositing.
see link below
P.S. Bonzo,
how did you make your blue starburst with transparent background.
If so, then I will have to make some mods to my starbrust script to overlay the starburst into the alpha channel rather than simply compositing.
see link below
P.S. Bonzo,
how did you make your blue starburst with transparent background.
Re: using Radial Flare for a mask
Thanks, that is what I wanted. Unless I am missing something, it appears to work fine with the image produced by your starburst script without modification. Though there appears to be a lot of empty space around the image that a -trim +repage doesn't affect, so perhaps that is what you meant.
Robert
Code: Select all
starburst -s 100x100 -n 100 a.png
composite -compose CopyOpacity a.png +matte \( rose: -resize 100x100! \) b.png
Robert
Re: using Radial Flare for a mask
I would like to say I created some realy clever and complicated code Fred but it was by accident !
I think the final image is quite good due to the strong colours in the original image.
Code: Select all
exec("convert -size 100x1 xc: +noise Random -channel G -separate +channel -scale 100x100! ( -size 100x100 gradient: -sigmoidal-contrast 8x50% ) -compose hardlight -composite -virtual-pixel HorizontalTileEdge -distort Polar -1 -background black -extent 300x156 flare_3_final.png");
exec("convert ( Blue_sunset.jpg -resize 300x300 ) flare_3_final.png ( -clone 1 -threshold -1 -virtual-pixel black -blur 10x65000 -level 50x100% ) ( -clone 1 -clone 2 -compose multiply -composite ) -delete 1,2 -compose copy_opacity -composite -trim out5.png");
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: using Radial Flare for a mask
Robert,grepper wrote:Thanks, that is what I wanted. Unless I am missing something, it appears to work fine with the image produced by your starburst script without modification. Though there appears to be a lot of empty space around the image that a -trim +repage doesn't affect, so perhaps that is what you meant.
Robert
you can control the length of the flares with the -r option
Fred
Re: using Radial Flare for a mask
Awesome, thanks Fred. I will be using the code you provided in your script in a script that makes DVD's from provided files: todisc from the tovid suite. http://tovid.wikia.com (with attribution to you and Anthony Thyssen of course). It will be one of the -thumb-shape options and looks really good in an animated menu! Applying a fair amount of blur also gives a nice semi-transparent vignette like effect.
Thanks too to Bonzo for his comments and code example.
Robert
Thanks too to Bonzo for his comments and code example.
Robert
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: using Radial Flare for a mask
IM has a vignette function, if you are interested. see http://www.imagemagick.org/Usage/transform/#vignette and viewtopic.php?f=1&t=15316&p=54264&hilit=vignette#p54078
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: using Radial Flare for a mask
Radial Flares are fun... But what i would really like to to make them more 'ray' like.
That is thick at the center and thinning out to nothing at the edges. At the moment the technique makes rays radially wider toward the edges.
my best results so for have been regular rays... as in Stars and Comets
http://www.imagemagick.org/Usage/advanced/#stars
However generating randomise rays, has not had a satisfactory answer as yet.
That is thick at the center and thinning out to nothing at the edges. At the moment the technique makes rays radially wider toward the edges.
my best results so for have been regular rays... as in Stars and Comets
http://www.imagemagick.org/Usage/advanced/#stars
However generating randomise rays, has not had a satisfactory answer as yet.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/