Page 1 of 1

replicating inner glow of flash

Posted: 2016-10-05T06:55:54-07:00
by arewaah
Hi!

Thank you for your time!

We are trying to replicate the inner glow filter of Flash AS3. We have an AS3 script that applies inner glow to an image. But we want to use the same parameters to be able to replicate in ImageMagick. Is that possible?

We are using the following script:

convert \( -size 778x1166 xc:none -fill '#bdbdbd' -draw 'rectangle 0,0,777 ,1165' \) \
\( -clone 0 -alpha extract \) \
\( -clone 0 -bordercolor red -border 40 -channel rgba -blur 15x65000 -shave 15x15 \) \
-delete 0 +swap -alpha off -compose copy_opacity -composite -auto-level -alpha off +level-colors red,white -alpha on b.jpg

The inner glow parameters from Flash are:

alpha = 1
color = 14695700
blurX = 61.2
blurY = 61.2
knockout = false
quality = 1
strength = 2

Out of these, only color, blurX and blurY are variable parameters in the as3 script. The rest remain the same.

Any help in this regard is welcome. Thank You!

Re: replicating inner glow of flash

Posted: 2016-10-05T07:25:06-07:00
by snibgo
I'm not sure what you are asking.

I last used Flash ActionScript about ten years ago, and I can't remember any details. If you want to replicate the action of an AS filter, please provide links to documentation and examples.

Re: replicating inner glow of flash

Posted: 2016-10-07T05:19:43-07:00
by arewaah
Hi Snibgo,

Thank you for your reply!

We are trying to replicate the following filter of AS:

http://help.adobe.com/en_US/FlashPlatfo ... ilter.html

An example can be seen at the following link:
http://www.republicofcode.com/tutorials ... s3filters/

We are trying to replicate the glow filter.

Thank you!

Re: replicating inner glow of flash

Posted: 2016-10-07T09:56:04-07:00
by fmw42
From the Glow Filter part of the page:

Code: Select all

The Glow Filter has the following properties:
    alpha - sets the transparency of the glow. Ranges from 0 to 1.
    blurX - amount of horizontal blur in the glow.
    blurY - amount of vertical blur in the glow.
    color - the color of the blur in hex value.
    inner - Set this to true to make the effect an inner glow.
    knockout - Set this to true to knockout the original shape and keep the glow only.
    quality - The number of glow duplicates used for the effect.
    strength - The intensity of the glow. Ranges from 0 to 255.
Note that blur can be expressed in different way and the values may mean different things in IM than in your AS3. So you may have to figure out the relationship and put in some scaling factor to achieve the same amount from the same value.

From:

Code: Select all

 quality - The number of glow duplicates used for the effect.
This tells me that the are not using the same method of blurring as in Imagemagick. They appear to be changing the size in steps to produce a ramp (linear?). IM's blur can be linear or gaussian in its roll-off.

So I imagine you may have to do some experimentation to get a similar result from IM with adjusted values. IM does not have any such quality argument in its blur.

Re: replicating inner glow of flash

Posted: 2016-10-07T10:40:24-07:00
by fmw42
Here is my attempt in unix syntax. I am not sure this will duplicate your AS3 since I do not have that to test.

Input:
Image

Code: Select all

quality=2
blur=10
glowcolor="black"
intensity=0
convert filters-removed.gif \
\( -clone 0 -fuzz 10% -fill white -opaque white \
-fill black +opaque white -write mpr:mask1 -negate \
-morphology erode square:$quality -blur ${blur}x65000 +level ${intensity}x100% -write mpr:mask2 +delete \) \
\( mpr:mask1 mpr:mask2 -compose plus -composite -compose over \) \
-alpha off -compose copy_opacity -composite \
-compose over -background $glowcolor -flatten result_q${quality}_b${blur}_g${glowcolor}_i${intensity}.png
Image

Code: Select all

quality=5
blur=10
glowcolor="black"
intensity=0
convert filters-removed.gif \
\( -clone 0 -fuzz 10% -fill white -opaque white \
-fill black +opaque white -write mpr:mask1 -negate \
-morphology erode square:$quality -blur ${blur}x65000 +level ${intensity}x100% -write mpr:mask2 +delete \) \
\( mpr:mask1 mpr:mask2 -compose plus -composite -compose over \) \
-alpha off -compose copy_opacity -composite \
-compose over -background $glowcolor -flatten result_q${quality}_b${blur}_g${glowcolor}_i${intensity}.png
Image

Code: Select all

quality=10
blur=10
glowcolor="black"
intensity=0
convert filters-removed.gif \
\( -clone 0 -fuzz 10% -fill white -opaque white \
-fill black +opaque white -write mpr:mask1 -negate \
-morphology erode square:$quality -blur ${blur}x65000 +level ${intensity}x100% -write mpr:mask2 +delete \) \
\( mpr:mask1 mpr:mask2 -compose plus -composite -compose over \) \
-alpha off -compose copy_opacity -composite \
-compose over -background $glowcolor -flatten result_q${quality}_b${blur}_g${glowcolor}_i${intensity}.png
Image


Code: Select all

quality=10
blur=10
glowcolor="black"
intensity=50
convert filters-removed.gif \
\( -clone 0 -fuzz 10% -fill white -opaque white \
-fill black +opaque white -write mpr:mask1 -negate \
-morphology erode square:$quality -blur ${blur}x65000 +level ${intensity}x100% -write mpr:mask2 +delete \) \
\( mpr:mask1 mpr:mask2 -compose plus -composite -compose over \) \
-alpha off -compose copy_opacity -composite \
-compose over -background $glowcolor -flatten result_q${quality}_b${blur}_g${glowcolor}_i${intensity}.png
Image