NoX1911
12th April 2011, 21:48
PNG/Overlay method:
Hi,
i'm using 'Overlay' to blend two pics together but it doesn't look right. On green, cyan, blue it looks like it was premultiplied with black or something.
http://img191.imageshack.us/img191/1234/colorsnj.th.jpg (http://img191.imageshack.us/img191/1234/colorsnj.jpg)
src = ColorBars(640, 480).ConvertToYUY2()
src = src.AssumeFPS(15).ShowFrameNumber()
logo = ImageReader("logo.png",0,0,1,true,pixel_type="rgb32")
logoMask = ShowAlpha(logo)
logoMask = logoMask.Loop(100).FadeOut(100)
Overlay(src, logo, x=(src.Width() - logo.Width()), y=(src.Height() - logo.Height()), mask=logoMask, mode="blend")
Download: Logo.png (http://img695.imageshack.us/img695/2773/logothn.png)
BMP/Layer method:
Here it looks similar.
A=10 #FadeStart (must be '2' or greater)
B=25 #FadeInLength
C=50 #FadeRest (Logo full visible)
D=25 #FadeOutLength
clip=ColorBars(640, 480).AssumeFPS(15).ConvertToRGB32
pic=ImageReader("logo2.bmp").ConvertToRGB32
clip1=clip.trim(0,A-1)
clip2=animate(A,A+B-1,"Layer",clip,pic,"add",0, clip,pic,"add",255).trim(A,A+B-1)
clip3=Layer(clip,pic,"add",255).trim(A+B,A+B+C-1)
clip4=animate(A+B+C,A+B+C+D-1,"Layer",clip,pic,"add",255,clip,pic,"add",0).trim(A+B+C,A+B+C+D-1)
clip5=clip.trim(A+B+C+D,0)
FinalClip=clip1+clip2+clip3+clip4+clip5
FinalClip.ConvertToYUY2
Download: Logo2.bmp (http://www.abload.de/img/logo228qo.bmp)
Maybe both methods handle the 2nd picture as premultiplied/white and thus not correctly. If you give the png a black background and save it as BMP (RGBA) it gives black halos. I tried the unpremultiply() (http://code.google.com/p/avisynth-unpremultiply/) plugin but it just gives a black screen.
The BMP should be premultiplied (white) but the PNG may be straight-alpha (if you load only RGB with 'Imagereader' it looks so).
I'm confused. What's the proper method to get the above picture blended in correctly?
AviSynth 2.5.8
Windows7 32Bit
Hi,
i'm using 'Overlay' to blend two pics together but it doesn't look right. On green, cyan, blue it looks like it was premultiplied with black or something.
http://img191.imageshack.us/img191/1234/colorsnj.th.jpg (http://img191.imageshack.us/img191/1234/colorsnj.jpg)
src = ColorBars(640, 480).ConvertToYUY2()
src = src.AssumeFPS(15).ShowFrameNumber()
logo = ImageReader("logo.png",0,0,1,true,pixel_type="rgb32")
logoMask = ShowAlpha(logo)
logoMask = logoMask.Loop(100).FadeOut(100)
Overlay(src, logo, x=(src.Width() - logo.Width()), y=(src.Height() - logo.Height()), mask=logoMask, mode="blend")
Download: Logo.png (http://img695.imageshack.us/img695/2773/logothn.png)
BMP/Layer method:
Here it looks similar.
A=10 #FadeStart (must be '2' or greater)
B=25 #FadeInLength
C=50 #FadeRest (Logo full visible)
D=25 #FadeOutLength
clip=ColorBars(640, 480).AssumeFPS(15).ConvertToRGB32
pic=ImageReader("logo2.bmp").ConvertToRGB32
clip1=clip.trim(0,A-1)
clip2=animate(A,A+B-1,"Layer",clip,pic,"add",0, clip,pic,"add",255).trim(A,A+B-1)
clip3=Layer(clip,pic,"add",255).trim(A+B,A+B+C-1)
clip4=animate(A+B+C,A+B+C+D-1,"Layer",clip,pic,"add",255,clip,pic,"add",0).trim(A+B+C,A+B+C+D-1)
clip5=clip.trim(A+B+C+D,0)
FinalClip=clip1+clip2+clip3+clip4+clip5
FinalClip.ConvertToYUY2
Download: Logo2.bmp (http://www.abload.de/img/logo228qo.bmp)
Maybe both methods handle the 2nd picture as premultiplied/white and thus not correctly. If you give the png a black background and save it as BMP (RGBA) it gives black halos. I tried the unpremultiply() (http://code.google.com/p/avisynth-unpremultiply/) plugin but it just gives a black screen.
The BMP should be premultiplied (white) but the PNG may be straight-alpha (if you load only RGB with 'Imagereader' it looks so).
I'm confused. What's the proper method to get the above picture blended in correctly?
AviSynth 2.5.8
Windows7 32Bit