Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Python by duffduffduff ( 16 years ago )
#!/usr/bin/env python

#PythonScript to make all necessary logos for the Avenarius Wohnheim
#Copyright MaxMustermann

from gimpfu import *

def python_avelogo(group, font, fontsize, textcolor, bordercolor, maxheight, directory, ext):

 #Create image
 img = gimp.Image(6024, 2480, RGB)

 #Begin Undo group
 img.undo_group_start()

 #Selcet foreground color
 gimp.set_foreground(bordercolor)


 intext = " " + group + " "

 #Create border layer
 border = pdb.gimp_text_fontname(img, -1, 0, 0, intext, 5, TRUE, fontsize, PIXELS, font)

 #Create selection
 selection = pdb.gimp_by_color_select(border, bordercolor, 0, REPLACE, TRUE, TRUE, 0, FALSE) 

 #Resize selection
 selection.selection_grow(fontsize / 9)

 #Fill border selection
 pdb.gimp_edit_fill(border, 0)

 #Selcet other foreground color
 gimp.set_foreground(textcolor)

 #Create text layer
 text = pdb.gimp_text_fontname(img, -1, 0, 0, intext, 5, TRUE, fontsize, PIXELS, font)

 #Autocrop
 pdb.plug_in_autocrop(img, border)

 #Currently h+w
 height = img.height()
 width = img.width()

 #Scale img
 pdb.gimp_image_scale(img, maxheight/height*width, maxheight)

 #Applies a gaussian blur to text
 pdb.plug_in_gauss(img, text, 1, 1, 1)

 #Merge layers
 pic = pdb.gimp_image_merge_visible_layers(img, 0)

 #End Undo group
 img.undo_group_end()

 pdb.gimp_selection_none(img)

 #Display img
 disp = gimp.Display(img)

 #Filesave
 filename = directory + "/" + "group" + "ext"
 pdb.gimp_file_save(img, pic, filename, filename)

register(
        "python_fu_avelogo",
        "Ave!LOGO",
        "PythonScript to make all necessary logos for the Avenarius Wohnheim",
        "Max",
        "Max",
        "2010",
 "<Image>/File/Create/create_avelogo",
        "",
        [
  [PF_STRING, "group", "Workspace", "NARIUS"],
  [PF_FONT, "font", "Font", "Sans Bold"],
  [PF_INT32, "fontsize", "Font size", 500],
  [PF_COLOR, 'textcolor', 'Text Color: ', (0,0,0)],
  [PF_COLOR, 'bordercolor', 'Border Color: ', (0,0,0)],
  [PF_INT32, "maxheight", "Max Height", 62],
  [PF_DIRNAME, "directory", "Directory", "/" ],
       [PF_STRING, "ext", "File extension", "png"]
        ],
        [],
        python_avelogo)
main()

 

Revise this Paste

Your Name: Code Language: