I would like to compose two image sources on each other, using alpha blending.
My problem is that:
1. If I just simply load the image with imagesource, the result is OK (I think it just discards the alpha channel)
2. However as soon as I do an Overlay or Layer operation, Avisynth seems to handle the alpha of the image wrong.
3. I believe the problem is pre-multiplied vs. post-multiplied alpha. I found a filter especially for fixing this, avisynth-unpremultiply (https://code.google.com/p/avisynth-unpremultiply/), however it made a totally crazy buggy colors with rainbow like blends and other bugs.
Is there any way to tell AviSynth to handle the alpha in my foreground images properly?
Here is my bg image:
https://dl.dropbox.com/s/fdq7hfm679hbmh2/composebug_bg.png
My foreground image:
https://dl.dropbox.com/s/t5c8rt0psu0l56o/composebug_fg.png
How it looks in AviSynth:
https://dl.dropbox.com/s/h7412jh6e81t1pl/composebug_avisynth.png
And how it should look, as when composed in After Effect, and selecting "premultiplied" for the foreground's alpha:
https://dl.dropbox.com/s/xb9igdqd8yyby4y/ae_00000.png
This is the Avisynth script I'm trying to use (in 2.60 b4):
Code:
background = ImageSource( "e:\render_outside\draft%05d.png", 1, 5600, 24, pixel_type="RGB24" ).ConvertToRGB32()
foreground = ImageSource( "e:\render_mixer\image%05d.png", 1, 5600, 24, pixel_type="RGB32" )
Layer( background, foreground )