Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th July 2008, 08:53   #1  |  Link
xbox360
Registered User
 
xbox360's Avatar
 
Join Date: Aug 2006
Location: Region 3 with NDS Encryption
Posts: 355
PNG image how to enable transparency ?

I have a .PNG with transparency that I am overlaying on my video, using this script:

Code:
SetMemoryMax(256)

LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\kerneldeint.dll")
Import("c:\Program Files (x86)\AviSynth 2.5\plugins\LimitedSharpen.avsi")

C = mpeg2source("D:\EncodingStuff\VR_MOVIE.d2v")
c.KernelDeint(order=0)
Letterbox(2,2,0,0,0)
LimitedSharpen( ss_x=2.0, ss_y=2.0, Smode=2)
FFT3DFilter(sigma=3)

logo = JDL_ImageSource("d:/assrender.png", fps=c.FrameRate())

Overlay(logo, x=0, y=0)
but the script outputs an image overlay with no transparency. How do I enable image transparency for my PNG overlay ?
xbox360 is offline   Reply With Quote
Old 8th July 2008, 09:06   #2  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
You need to modify JDL_ImageSource (to include pixel_type), or use ImageSource.
Wilbert is offline   Reply With Quote
Old 8th July 2008, 09:09   #3  |  Link
xbox360
Registered User
 
xbox360's Avatar
 
Join Date: Aug 2006
Location: Region 3 with NDS Encryption
Posts: 355
ImageSource does not work !
xbox360 is offline   Reply With Quote
Old 8th July 2008, 09:26   #4  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Overlay does not use the alpha channel explicitly. You need to use
Code:
Overlay(logo, x=0, y=0, mask=logo.ShowAlpha)
Gavino is offline   Reply With Quote
Old 8th July 2008, 09:39   #5  |  Link
xbox360
Registered User
 
xbox360's Avatar
 
Join Date: Aug 2006
Location: Region 3 with NDS Encryption
Posts: 355
Im using:

Code:
SetMemoryMax(256)

LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\kerneldeint.dll")
Import("c:\Program Files (x86)\AviSynth 2.5\plugins\LimitedSharpen.avsi")

C = mpeg2source("D:\EncodingStuff\VR_MOVIE.d2v")
c.KernelDeint(order=0)
Letterbox(2,2,0,0,0)
LimitedSharpen( ss_x=2.0, ss_y=2.0, Smode=2)
FFT3DFilter(sigma=3)

logo = ImageSource("d:/dtsrender.png", fps=c.FrameRate()).converttorgb32

Overlay(logo, x=0, y=0, mask=logo.ShowAlpha)
still no diference
xbox360 is offline   Reply With Quote
Old 8th July 2008, 10:08   #6  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by xbox360 View Post
Code:
logo = ImageSource("d:/dtsrender.png", fps=c.FrameRate()).converttorgb32
You are throwing away the transparency and putting an opaque image in its place. Do this:
Code:
logo = ImageSource("d:/dtsrender.png", fps=c.FrameRate(), pixel_type="RGB32")
Gavino is offline   Reply With Quote
Old 8th July 2008, 10:12   #7  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
Quote:
Originally Posted by Wilbert View Post
You need to modify JDL_ImageSource (to include pixel_type), or use ImageSource.
JDL_ImageSource automatically sets pixel_type="rgb32" (and falls back if it's unsupported).

Anyway,
Code:
video = ColorBars()
logo = JDL_ImageSource("avisynth-logo-gears-mod.png")
Overlay(video, logo, x=0, y=0, mask=logo.ShowAlpha())
works for me with the AviSynth logo image.

If it's still not working for you, please post the PNG you're trying to use.
stickboy is offline   Reply With Quote
Old 8th July 2008, 10:36   #8  |  Link
xbox360
Registered User
 
xbox360's Avatar
 
Join Date: Aug 2006
Location: Region 3 with NDS Encryption
Posts: 355
Im using:

Code:
SetMemoryMax(256)

LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\kerneldeint.dll")
Import("c:\Program Files (x86)\AviSynth 2.5\plugins\LimitedSharpen.avsi")

C = mpeg2source("D:\EncodingStuff\VR_MOVIE.d2v")
c.KernelDeint(order=0)
Letterbox(2,2,0,0,0)
LimitedSharpen( ss_x=2.0, ss_y=2.0, Smode=2)
FFT3DFilter(sigma=3)

logo = ImageSource("d:/assrender.png", pixel_type="RGB32")

Overlay(logo, x=0, y=0, mask=logo.ShowAlpha())
& It Works Perfectly ! Thank You for helping !
xbox360 is offline   Reply With Quote
Old 9th July 2008, 06:22   #9  |  Link
xbox360
Registered User
 
xbox360's Avatar
 
Join Date: Aug 2006
Location: Region 3 with NDS Encryption
Posts: 355
I have a problem. My script is this:

Code:
SetMemoryMax(256)

LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\kerneldeint.dll")
Import("c:\Program Files (x86)\AviSynth 2.5\plugins\LimitedSharpen.avsi")

C = mpeg2source("D:\EncodingStuff\VR_MOVIE.d2v")
c.KernelDeint(order=0)
Lanczos4Resize(720,576,0,72,-0,-72)
LimitedSharpen( ss_x=2.0, ss_y=2.0, Smode=2)
FFT3DFilter(sigma=3)

logo = ImageSource("d:/assrender.png", pixel_type="RGB32")

Overlay(logo, x=0, y=0, mask=logo.ShowAlpha())
Now when I encode with 16:9 flag the logo's height get's compressed, how to avoid this ?
xbox360 is offline   Reply With Quote
Old 9th July 2008, 08:26   #10  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
You will need to resize your logo to match the pixel aspect ratio of your source.
Code:
...
logo = logo.Spline36Resize(logo.Width(), logo.Height()*4/3)
...
Hint :- If you click the Edit button there is an option to delete your duplicate post.
IanB is offline   Reply With Quote
Old 9th July 2008, 14:40   #11  |  Link
NerdWithNoLife
Registered User
 
NerdWithNoLife's Avatar
 
Join Date: Jul 2007
Posts: 157
ImageSource doesn't work for a png? What does it say? Because I would do something like:
Code:
SetMemoryMax(256)

LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\kerneldeint.dll")
Import("c:\Program Files (x86)\AviSynth 2.5\plugins\LimitedSharpen.avsi")

C = mpeg2source("D:\EncodingStuff\VR_MOVIE.d2v").\
KernelDeint(order=0).Letterbox(2,2,0,0,0).\
LimitedSharpen( ss_x=2.0, ss_y=2.0, Smode=2).FFT3DFilter(sigma=3).ConvertToRGB32()

logo = ImageSource("d:/assrender.png",pixel_type="RGB32").AssumeFPS(c)

Layer(c,logo,"add",255)
And yes, you may need to resize to make them have the same properties.

Edit: Well, I see you resolved it after reading more carefully. There's more than one way to skin a cat, I suppose... maybe this could help someone though.

Last edited by NerdWithNoLife; 9th July 2008 at 14:46. Reason: Misreading
NerdWithNoLife is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:45.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.