Here are a couple of outputs. I started with snibgo's idea of making a diagonal flare image. The code is in Unix syntax.
Input:
Here I threshold the image to get the brightest 1% but remove thicker spots:
Code: Select all
convert sparkle.jpg -negate -threshold 1% -negate -morphology open diamond:2 -type bilevel tmp1.png
Here I draw the diagonal lines and blur them
Code: Select all
convert \
-size 140x140 xc:black \
-fill white \
-draw "line 0,0 139,139 line 0,139 139,0" -alpha off \
-virtual-pixel black \
-blur 0x3 \
tmp2.png
Here I use snibgo's method of adding the gradients to the lines
Code: Select all
convert \
tmp2.png \
-virtual-pixel Edge \
-distort depolar 0 \
-distort SRT 0,-5,1,0,0,0 \
-auto-level \
-level 5%,50% \
\( +clone -sparse-color bilinear "0,0,White 0,%[fx:h-1],Black" \) \
-compose Multiply -composite \
-distort polar 0 \
tmp3.png
Here I have to use HDRI, so I use IM 7 which includes it. You could do it all in IM 7 or with a build of IM 6 with HDRI. The step does a convolution of the star pattern above with the tmp1 top 1% bright image in the Fourier domain. A limitation of ImageMagick here is that both images must be padded with black to the same square and even dimension. The padded out star image must them be rolled so that what was in the center is at the top left corner.
Code: Select all
magick \
\( tmp1.png +fft -background black -gravity center -extent 2736x2736 \) \
\( tmp3.png -background black -gravity center -extent 2736x2736 -roll -1369-1369 +fft \) \
-complex multiply +ift \
-auto-level -gravity northwest -crop 2736x1824+0+0 +repage tmp4.png
Here I try one method of composing the result onto the original. I use -evaluate log for gain. One could also use -evaluate pow in stead.
Code: Select all
convert sparkle.jpg \( tmp4.png -evaluate log 100 \) -compose lighten -composite sparkle_result2.png
Here I try another method of composing.
Code: Select all
convert sparkle.jpg \( +clone -fill white -colorize 100 \) \( tmp4.png -evaluate log 100 \) -compose lighten -composite sparkle_result1.png
P.S. If one uses polar -1 and depolar -1, you will get the star pattern to fill out the image, so the stars will match the size of the initial lines.
Code: Select all
convert \
tmp2.png \
-virtual-pixel Edge \
-distort depolar -1 \
-distort SRT 0,-5,1,0,0,0 \
-auto-level \
-level 5%,50% \
\( +clone -sparse-color bilinear "0,0,White 0,%[fx:h-1],Black" \) \
-compose Multiply -composite \
-distort polar -1 \
tmp3b.png
![Image](http://www.fmwconcepts.com/misc_tests/flare_effect/tmp3b.png)