VideoHelp Forum
+ Reply to Thread
Results 1 to 1 of 1
Thread
  1. Member
    Join Date
    Jun 2007
    Location
    Canada
    Search Comp PM
    Hi

    I've created an avs script that allows the user to preview fonts, textcolors, halocolors and background colors automatically.

    First of all I would like to thank Gavino for his GScript plugin -> http://forum.doom9.org/showthread.php?t=147846

    The GScript plugin is required which permits use of loops and if else statements

    Just download GScript and place GScript.dll in your avisynth plugin folder [it's only 104 KB]

    I am attaching colors-fonts.avsi.txt which contains color value, color name and fontname information for 144 colors and 34 fonts

    Just rename to colors-fonts.avsi and put it in your avisynth plugin folder

    You can use AvsP[Mod] to preview the avs file and save as bmp/jpg/gif/pcx/png/tiff or you can open it in VirtualDub copy the source frame and paste into your imageviewer and save as image, or you can open avs file in VirtualDubMod and edit the script. You can also encode the avs to a videoclip. If you want more than one frame just change:

    blankclip(1,WIDTH,ROWHEIGHT,color=$ffffff) to blankclip(the number of frames you want,WIDTH,ROWHEIGHT,color=$ffffff)


    Here is the avs script: B-F-T-H_1.avs
    ################################################## ################################
    #~ Just type in the values for FONTSIZE, ROWSPACE, XSPACE, WIDTH, and LOOP
    FONTSIZE=20 /* fontsize in pixels */
    ROWSPACE=3 /* rowspace */
    XSPACE=4 /* leftmargin in pixels */
    WIDTH=800 /* clipwidth in pixels */
    #~ Maximum value for LOOP is 144 = total number of colors
    LOOP=24 /* # of iterations */
    ROWHEIGHT=(fontsize+ROWSPACE) /* height of rows*/
    HEIGHT=(loop+ROWSPACE)*ROWHEIGHT /* clipheight in pixels */
    #~ Dont change the value of FontNUM
    FontNUM=34 /*# of fonts */
    #~ If you want the TEXTSTRING to use ONE FONT - then assign a # value to font1 - OTHERWISE make sure font1=""
    font1="Arial Italic Sans Serif"
    nFont=f32 /* font name 1st&last blankclip */
    #~ If you want the BLANKCLIPS to have ONE BACKGROUND COLOR - then assign a #value to BColor - OTHERWISE make sure bColor=""
    bColor=""
    BGColor="c" +bColor
    BGColor1="d" +bColor
    #~ If you want the TEXTSTRING to have ONE TEXT COLOR - then assign a #value to tColor - OTHERWISE make sure tColor=""
    tColor="8"
    textColor="c" +tColor
    textColor1="d" +tColor
    #~ If you want the TEXTSTRING to have ONE HALO COLOR - then assign a #value to hColor - OTHERWISE make sure hColor=""
    hColor=""
    haloColor="c" +hColor
    haloColor1="d" +hColor
    textstring=""
    #~ textstring="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSs TtUuVvWwXxYyZz"
    blankclip(1,WIDTH,ROWHEIGHT,color=$ffffff)
    s1=subtitle(last, " # b:bgcolor f:font t:textcolor h:halocolor" +" Resolution="+ string(WIDTH) + "x" + string(HEIGHT) , x=xspace,y=1,font=nFont,size=fontsize,text_color=$ ffffff, halo_color=$000000)
    s1
    GScript("""
    for ( i = 1, LOOP ) {
    c = Eval("c"+String(i))
    if (BGColor <> "c") {
    cinc=Eval(String(BGColor))
    }
    else {
    cinc = Eval("c"+String(i))
    }
    z= blankclip(1,WIDTH,ROWHEIGHT,color=cinc)
    stackvertical(z)
    }
    """)

    GScript("""
    for ( i = 1, LOOP ) {
    if (i > FontNUM*4 < loop+1 ) {
    l=i-(FontNUM*4)
    f=Eval("f"+String(l))
    }
    else {
    if (i > FontNUM*3 < (FontNUM*4)+1 ) {
    k=i-(FontNUM*3)
    f=Eval("f"+String(k))
    }
    else {
    if (i > FontNUM*2 < (FontNUM*3)+1 ) {
    j=i-(FontNUM*2)
    f=Eval("f"+String(j))
    }
    else {
    if (i > FontNUM < (FontNUM*2)+1 ) {
    f=Eval("f"+String(i-FontNUM))
    }
    else {
    f=Eval("f"+String(i))
    }
    }
    }
    }
    c = Eval("c"+String(i))
    d = Eval("d"+String(i))
    if (BGColor <> "c") {
    dinc=Eval(String(BGColor1))
    }
    else {
    dinc = Eval("d"+String(i))
    }
    if (tColor <> "c") {
    cinc1=Eval(String(textColor))
    dinc1=Eval(String(textColor1))
    }
    else {
    cinc1 = Eval("c"+String(i))
    dinc1 = Eval("d"+String(i))
    }
    if (hColor <> "c") {
    cinc2=Eval(String(haloColor))
    dinc2=Eval(String(haloColor1))
    }
    else {
    cinc2 = Eval("c"+String(i))
    dinc2 = Eval("d"+String(i))
    }
    if (font1<>"") {
    f=font1
    }
    else {
    f=f
    }
    textstring1=" b:" + dinc +" f:" + f + " t:" + dinc1+ " h:" +dinc2
    s2=subtitle(last,string(i) + ". " + textstring + textstring1,x=xspace,y=ROWHEIGHT*i,font=f,size=fon tsize,text_color=cinc1, halo_color=cinc2)
    s2
    }
    stackvertical(s2,s1)
    """)
    ################################################## ################################

    I am attaching B-F-T-H_1.avs, colors-fonts.avsi.txt, test.jpg, test1.jpg

    Here is a sample = test.jpg
    I used FONTSIZE=20, ROWSPACE=3, XSPACE=4, WIDTH=800, LOOP=24
    I set font1="Arial Bold Italic", bColor="" [use all background colors], tColor="8" [Black], hColor="67" [LightGoldenrodYellow]

    This lets the user see how Arial Bold Italic in Black text with halocolor of LightGoldenrodYellow looks like on 24 different backgrounds

    Then I set font1="" [use 24 different fonts] see test1.jpg
    This lets the user see how 24 different fonts in Black text with halocolor of LightGoldenrodYellow look like on 24 different backgrounds

    I am working on another script that will allow the user to use up to 144 different background colors with 144 different textcolors with 144 different halocolors using one or 34 different fonts - so the possible combinations will be:

    144 different background colors * 144 different textcolors * 144 different halocolors = 2,985,984 * 34 fonts

    There are many different uses for this:
    You want to add Subtitles to a DVD and want to decide on the best font, textcolor and halocolor combinations for readability
    You want to make some banners for a website - you have some colors in mind and want to see what different font types will look like
    You have selected a textcolor and a halocolor and want to see how they look using different fonts and/or background colors

    P.S. I posted a similar script on doom9 avisynth forum that allows the user to "stagger" the values on background color, textcolor and fontcolor - but I want to incorporate this script with that one for more features.

    In the next couple of days I will be posting numerous sample images and user notes on a new website.
    Image Attached Thumbnails Click image for larger version

Name:	test.jpg
Views:	374
Size:	239.7 KB
ID:	12431  

    Click image for larger version

Name:	test1.jpg
Views:	371
Size:	236.1 KB
ID:	12434  

    Image Attached Files
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!