示例#1
0
 def _load_default_font(self):
     import aggdraw
     try:
         return aggdraw.Font(
             "black",
             "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf",
             size=16)
     except IOError:
         return aggdraw.Font("black",
                             "/usr/share/fonts/dejavu/DejaVuSerif.ttf",
                             size=16)
示例#2
0
    def getPhrase28(i):
        image = Image.new("L", (1150, 605), "black")
        d = aggdraw.Draw(image)
        font = aggdraw.Font("white", "adler.ttf", 36)
        text = ["These seeds = learning about: "]
        text.append("             ")
        text.append("   - shared realities")
        text.append("             ")
        text.append("   - clarity on solutions to problems")
        text.append("             ")
        text.append("   - leader disciplines needed to implement")
        text.append("     solutions")
        text.append("             ")
        text.append("   - rights & laws on which solutions are based")
        text.append("             ")
        text.append("   - personal & communal autonomy, including ")
        text.append("     how to negociate with government")

        offset = 0
        offsetY = 0
        for frag in text:
            d.text((10, offsetY), frag[0:max(i - offset, 0)], font)
            offsetY += 40
            offset += len(frag)
        d.flush()
        return image
示例#3
0
class evolve(evolve_base):
    font = aggdraw.Font("white", "./fonts/font1.ttf", 46)
    phrase1 = {languages.ENGLISH: Phrases().makeImage([u"If I could remove", u"blocks from the wall...?"], font),
               languages.SPANISH: Phrases().makeImage([u"\u00bfSi pudiera quitar los", u"ladrillos de la pared...?"],
                                                      font),
               languages.GERMAN: Phrases().makeImage(
                   [u"Wenn ich nur die Ziegel von", u"der Wand nehmen k\u00f6nnte...?"],
                   font)}
    phrase2 = {
        languages.ENGLISH: Phrases().makeImage([u"AND if the person on the", u"other side does the same..."], font),
        languages.SPANISH: Phrases().makeImage([u"Y si la persona del", u"otro lado hiciera lo mismo..."], font),
        languages.GERMAN: Phrases().makeImage([u"UND wenn die Person auf der", u"anderen Seite das gleiche tut...."],
                                              font)}
    phrase3 = {languages.ENGLISH: Phrases().makeImage([u"We can actually grow", u"the sustainable!"], font),
               languages.SPANISH: Phrases().makeImage([u"\u00a1De hecho podemos", u"crecer sustentablemente!"], font),
               languages.GERMAN: Phrases().makeImage(
                   [u"Koennen wir tats\u00e4chlich", u"etwas nachhaltiges erschaffen!"],
                   font)}

    def __init__(self, start):
        self.startTime = start
        self.stopTime = start + 156
        self.list = []
        self.list.append(pensativo(start))
        self.list.append(rolling_tl(start + 10))
        self.list.append(rolling_tlb(start + 75))
        self.list.append(slider(start + 130))
        self.list.append(OneThought(start + 0, self.phrase1, 500, True))
        self.list.append(OneThought(start + 30, self.phrase2, 877, False))
        self.list.append(OneThought(start + 60, self.phrase3, 500, True, True))
示例#4
0
class evolve(evolve_base):
    font = aggdraw.Font("white", "./fonts/calibrib.ttf", 46)
    text_english = [u"PSYDEH and Global Citizens:", u"growing trees with rural and", u"indigenous partners in Mexico."]
    text_spanish = [u"PSYDEH y Ciudadanos del Mundo:", u"tirando paredes y plantando arboles junto",
                    u"con nuestros socios ind\u00EDgenas en M\u00e9xico."]
    phrase1 = {languages.ENGLISH: [Phrases().makeImage_runnable(text_english, font, 50), 1.0],
               languages.SPANISH: [Phrases().makeImage_runnable(text_spanish, font, 50),
                                   Helpers.getLetterRatio(text_english, text_spanish)]}
    text_english = [u"Visit PSYDEH's website for more", u"information: "]
    text_spanish = [u"Para m\u00e1s informaci\u00f3n visita la", u"p\u00e1gina web de PSYDEH: "]
    phrase2 = {languages.ENGLISH: [Phrases().makeImage_runnable(text_english, font, 50), 1.0],
               languages.SPANISH: [Phrases().makeImage_runnable(text_spanish, font, 50),
                                   Helpers.getLetterRatio(text_english, text_spanish)]}

    text_english = [u"www.psydeh.com"]
    text_spanish = [u"www.psydeh.com"]
    phrase3 = {languages.ENGLISH: [Phrases().makeImage_runnable(text_english, font, 50), 1.0],
               languages.SPANISH: [Phrases().makeImage_runnable(text_spanish, font, 50),
                                   Helpers.getLetterRatio(text_english, text_spanish)]}

    def __init__(self, start):
        self.startTime = start
        self.stopTime = start + 265
        self.list = []
        self.list.append(still(start))
        self.list.append(text(start, 265, self.phrase1, (310, 50)))
        self.list.append(text(start + 85, 195, self.phrase2, (310, 600)))
        self.list.append(
            text(start + 85 + 44, 151, self.phrase3, (310 + 252 + 1 * 210, 600 + 50),
                 slow=0, color=(80, 147, 205)))
        self.list.append(Transitions.blender(None, Image.open("./images/base16_spanish.png"), start + 225, 40))
示例#5
0
 def draw_text(self, x, y, text, **options):
     """
     draws basic text, no effects
     """
     fontlocation = self.sysfontfolders[OSSYSTEM]+self.fontfilenames[options["textfont"]]
     font = aggdraw.Font(color=options["textcolor"], file=fontlocation, size=options["textsize"], opacity=options["textopacity"])
     fontwidth, fontheight = self.drawer.textsize(text, font)
     textanchor = options.get("textanchor")
     if textanchor:
         textanchor = textanchor.lower()
         if textanchor == "center":
             x = int(x) - int(fontwidth/2.0)
             y = int(y) - int(fontheight/2.0)
         else:
             x = int(x) - int(fontwidth/2.0)
             y = int(y) - int(fontheight/2.0)
             if "n" in textanchor:
                 y = int(y)
             elif "s" in textanchor:
                 y = int(y) - int(fontheight)
             if "e" in textanchor:
                 x = int(x) - int(fontwidth)
             elif "w" in textanchor:
                 x = int(x)
     if options.get("textboxfillcolor") or options.get("textboxoutlinecolor"):
         relfontwidth, relfontheight = (fontwidth/float(MAPWIDTH), fontheight/float(MAPHEIGHT))
         relxmid,relymid = (x/float(MAPWIDTH)+relfontwidth/2.0,y/float(MAPHEIGHT)+relfontheight/2.0)
         relupperleft = (relxmid-relfontwidth*options["textboxfillsize"]/2.0, relymid-relfontheight*options["textboxfillsize"]/2.0)
         relbottomright = (relxmid+relfontwidth*options["textboxfillsize"]/2.0, relymid+relfontheight*options["textboxfillsize"]/2.0)
         options["fillcolor"] = options["textboxfillcolor"]
         options["outlinecolor"] = options["textboxoutlinecolor"]
         options["outlinewidth"] = options["textboxoutlinewidth"]
         self.RenderRectangle(relupperleft, relbottomright, options)
     self.drawer.text((x,y), text, font)
示例#6
0
    def test_grid_nh_agg(self):
        from pycoast import ContourWriterAGG
        import aggdraw
        grid_img = Image.open(
            os.path.join(os.path.dirname(__file__), 'grid_nh_agg.png'))
        grid_data = np.array(grid_img)
        img = Image.new('RGB', (425, 425))
        proj4_string = '+proj=laea +lat_0=90 +lon_0=0 +a=6371228.0 +units=m'
        area_extent = (-5326849.0625, -5326849.0625, 5326849.0625,
                       5326849.0625)
        area_def = (proj4_string, area_extent)

        cw = ContourWriterAGG(gshhs_root_dir)

        cw.add_coastlines(img, area_def, resolution='l', level=4)
        font = aggdraw.Font('blue',
                            os.path.join(os.path.dirname(__file__),
                                         'test_data', 'DejaVuSerif.ttf'),
                            size=10)
        cw.add_grid(img,
                    area_def, (10.0, 10.0), (2.0, 2.0),
                    font=font,
                    fill='blue',
                    outline='blue',
                    minor_outline='blue',
                    lon_placement='tblr',
                    lat_placement='')

        res = np.array(img)

        # NOTE: Experience inconsistency in ttf font writing between systems.
        # Still trying to figure out why this test sometimes fails to write
        # correct font markings.
        self.assertTrue(fft_metric(grid_data, res),
                        'Writing of nh grid failed for AGG')
示例#7
0
def drawLetter(letter, size=28, font=None, font_size=15):
    """Draw a mask of a letter (used for training a classifier)."""

    #
    # Prepare the template canvas
    #
    img = Image.new(mode='L', size=(size, size))

    ctx = aggdraw.Draw(img)

    if font is None:
        import platform
        if platform.system() == 'Linux':
            font = r"/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf"
        else:
            font = r"C:\Windows\Fonts\Arialbd.ttf"

    C = np.array(((size / font_size * 4 / 5, 0, size / 2),
                  (0, size / font_size * 4 / 5, size / 2), (0, 0, 1)))
    ctx.settransform(C.ravel()[:6])

    font = aggdraw.Font(255, font, font_size)
    text_size = ctx.textsize(letter, font)
    position = [-text_size[i] / 2 for i in range(2)]
    ctx.text(position, letter, font)

    #
    # Flush to apply drawing.
    #
    ctx.flush()
    img = np.array(img)

    return img
示例#8
0
文件: AggHelp.py 项目: godber/ginga
 def get_font(self, name, size, color, alpha=1.0):
     color = self.get_color(color)
     op = int(alpha * 255)
     # TODO: what kind of lookup can we use for this?
     filename = '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf'
     f = agg.Font(color, filename, size=size, opacity=op)
     return f
示例#9
0
    def test_grid_agg_txt(self):
        from pycoast import ContourWriterAGG
        import aggdraw
        grid_img = Image.open(
            os.path.join(os.path.dirname(__file__), 'grid_europe_agg_txt.png'))
        grid_data = np.array(grid_img)

        img = Image.new('RGB', (640, 480))
        proj4_string = '+proj=stere +lon_0=8.00 +lat_0=50.00 +lat_ts=50.00 +ellps=WGS84'
        area_extent = (-3363403.31, -2291879.85, 2630596.69, 2203620.1)
        area_def = (proj4_string, area_extent)

        cw = ContourWriterAGG(gshhs_root_dir)

        cw.add_coastlines(img, area_def, resolution='l', level=4)
        font = aggdraw.Font('blue',
                            os.path.join(os.path.dirname(__file__),
                                         'test_data', 'DejaVuSerif.ttf'),
                            size=16,
                            opacity=200)
        cw.add_grid(img,
                    area_def, (10.0, 10.0), (2.0, 2.0),
                    font=font,
                    outline='blue',
                    outline_opacity=255,
                    width=1.0,
                    minor_outline='lightblue',
                    minor_outline_opacity=255,
                    minor_width=0.5,
                    minor_is_tick=False)

        res = np.array(img)
        self.failUnless(fft_metric(grid_data, res),
                        'Writing of grid failed for AGG')
示例#10
0
 def getPhrase127(i):
     image = Image.new("L", (510, 60), "black")
     d = aggdraw.Draw(image)
     font = aggdraw.Font("white", "adler.ttf", 40)
     d.text((10, 0), "www.psydeh.com"[0:max(i, 0)], font)
     d.flush()
     return image
示例#11
0
    def test_grid_nh(self):
        from pycoast import ContourWriterAGG
        import aggdraw
        grid_img = Image.open(
            os.path.join(os.path.dirname(__file__), 'grid_nh_agg.png'))
        grid_data = np.array(grid_img)
        img = Image.new('RGB', (425, 425))
        proj4_string = '+proj=laea +lat_0=90 +lon_0=0 +a=6371228.0 +units=m'
        area_extent = (-5326849.0625, -5326849.0625, 5326849.0625,
                       5326849.0625)
        area_def = (proj4_string, area_extent)

        cw = ContourWriterAGG(gshhs_root_dir)

        cw.add_coastlines(img, area_def, resolution='l', level=4)
        font = aggdraw.Font('blue',
                            os.path.join(os.path.dirname(__file__),
                                         'test_data', 'DejaVuSerif.ttf'),
                            size=10)
        cw.add_grid(img,
                    area_def, (10.0, 10.0), (2.0, 2.0),
                    font=font,
                    fill='blue',
                    outline='blue',
                    minor_outline='blue',
                    lon_placement='tblr',
                    lat_placement='')

        res = np.array(img)
        self.failUnless(fft_metric(grid_data, res),
                        'Writing of nh grid failed for AGG')
示例#12
0
 def _load_font(self):
     import aggdraw
     try:
         return aggdraw.Font(self.style['line'], self.style['font'],
                             self.style['font_size'])
     except IOError:
         raise
示例#13
0
class evolve(evolve_base):
    font = aggdraw.Font("white", "./fonts/font1.ttf", 46)
    phrase1 = {languages.ENGLISH: Phrases().makeImage([u"We build a wall?", u"     Really?"], font),
               languages.SPANISH: Phrases().makeImage([u"\u00bfConstruimos una pared?", u"     \u00bfEn serio?"], font),
               languages.GERMAN: Phrases().makeImage([u"Wir errichten eine Mauer?", u"  Wirklich?"], font)}
    phrase2 = {languages.ENGLISH: Phrases().makeImage([u"What are people like", u"on the other side?"], font),
               languages.SPANISH: Phrases().makeImage([u"\u00bfComo es la gente del otro lado?"], font),
               languages.GERMAN: Phrases().makeImage([u"Wie sind die Leute", u"auf der anderen Seite?"], font)}
    phrase3 = {languages.ENGLISH: Phrases().makeImage([u"American"], font),
               languages.SPANISH: Phrases().makeImage([u"Americano"], font),
               languages.GERMAN: Phrases().makeImage([u"Amerikaner"], font)}
    phrase4 = {languages.ENGLISH: Phrases().makeImage([u"Mexican"], font),
               languages.SPANISH: Phrases().makeImage([u"Mexicano"], font),
               languages.GERMAN: Phrases().makeImage([u"Mexikaner"], font)}
    phrase5 = {languages.ENGLISH: Phrases().makeImage([u"Latinos, Europeans", u"  or Asians"], font),
               languages.SPANISH: Phrases().makeImage([u"Latinos, Europeos", u"  o Asi\u00e1ticos"], font),
               languages.GERMAN: Phrases().makeImage([u"Latinos, Europ\u00e4er", u"oder Asiaten"], font)}
    phrase6 = {languages.ENGLISH: Phrases().makeImage([u"We are so", u"different."], font),
               languages.SPANISH: Phrases().makeImage([u"Somos tan", u"diferentes"], font),
               languages.GERMAN: Phrases().makeImage([u"Wir sind so", u"verschieden"], font)}

    def __init__(self, start):
        self.startTime = start
        self.stopTime = start + 270
        self.image = Image.open("./images/base1.png")
        d = aggdraw.Draw(self.image)
        p = aggdraw.Pen("black", 8.46666)
        d.ellipse((640 - 315, 596, 640 + 315, 596), p)
        d.flush()
        self.thoughts = [Tools.OneThought(start + 0, self.phrase1, 380)]
        self.thoughts.append(Tools.OneThought(start + 30, self.phrase2, 945))
        self.thoughts.append(Tools.OneThought(start + 60, self.phrase3, 380))
        self.thoughts.append(Tools.OneThought(start + 90, self.phrase4, 945))
        self.thoughts.append(Tools.OneThought(start + 120, self.phrase5, 380))
        self.thoughts.append(Tools.OneThought(start + 150, self.phrase6, 945))

        self.thoughts.append(Tools.OneFlag(start + 100, start + 170, Flags.AMERICA, 462, 349))
        self.thoughts.append(Tools.OneFlag(start + 130, start + 200, Flags.MEXICO, 826, 349))

        self.thoughts.append(Tools.OneFlag(start + 150, start + 200, Flags.MEXICO, 462, 349))
        self.thoughts.append(Tools.OneFlag(start + 170, start + 230, Flags.AUSTRALIA, 462, 349))
        self.thoughts.append(Tools.OneFlag(start + 190, start + 260, Flags.SPAIN, 462, 349))
        self.thoughts.append(Tools.OneFlag(start + 210, start + 300, Flags.JAPAN, 462, 349))
        # self.thoughts.append(Tools.OneFlag(start + 230, start + 380, "dove", 462, 349))

        self.thoughts.append(Tools.OneFlag(start + 175, start + 245, Flags.BRITAIN, 826, 349))
        self.thoughts.append(Tools.OneFlag(start + 195, start + 275, Flags.HONDURAS, 826, 349))
        self.thoughts.append(Tools.OneFlag(start + 215, start + 315, Flags.RUSSIA, 826, 349))
        # self.thoughts.append(Tools.OneFlag(start + 205, start + 380, "idove", 826, 349))

        self.thoughts.append(Tools.ThoughtfulTransition(start + 180, Image.open("./images/base2.png"), 380))
        self.list = self.thoughts

    def draw(self, frame, image):
        if (frame < self.startTime or frame >= self.stopTime):
            return
        image.paste(self.image, (0, 0))
        for though in self.thoughts:
            though.draw(frame, image)
示例#14
0
 def getPhrase16():
     image = Image.new("L", (180, 60), "black")
     d = aggdraw.Draw(image)
     font = aggdraw.Font("white", "font1.ttf", 36)
     d.text((10, 0), "Differences and", font)
     d.text((30, 25), "change are scary.", font)
     d.flush()
     return image
示例#15
0
    def get_font(self, name, size, color, alpha=1.0):
        color = self.get_color(color)
        op = int(alpha * 255)

        # TODO: try to lookup font before overriding
        filepath = known_font

        f = agg.Font(color, filepath, size=size, opacity=op)
        return f
示例#16
0
def add_title(PIL_image, rgb, sat_nr, dateS, hourS, minS, area, dc, font_file,
              verbose):

    if verbose:
        print("    add title to image ")

    if True:

        if PIL_image.mode == 'RGB' or PIL_image.mode == 'RGBA':  # color
            title_color = (255, 255, 255)
            outline = (255, 0, 0)
        elif PIL_image.mode == 'L':  # black white
            title_color = (255)
            outline = (255)

        # determine font size
        if area == "EuropeCanary":
            font_size = 36
        elif area.find("ticino") != -1:
            font_size = 12
        else:
            font_size = 18
        font = ImageFont.truetype(font_file, font_size)

        title = ' ' + "MSG-" + str(
            sat_nr - 7
        ) + ', ' + dateS + ' ' + hourS + ':' + minS + 'UTC, ' + area + ', ' + rgb
        draw = ImageDraw.Draw(PIL_image)

        if area.find("EuropeCanary") == -1:
            draw.text((0, 0), title, title_color, font=font)
        else:
            draw.text((0, 5),
                      ' ' + "MSG-" + str(sat_nr - 7) + ' SEVIRI',
                      title_color,
                      font=font)
            draw.text((0, 25),
                      ' ' + dateS + ' ' + hourS + ':' + minS + 'UTC',
                      title_color,
                      font=font)
            draw.text((0, 45),
                      ' ' + rgb.replace("_", "-"),
                      title_color,
                      font=font)

        if verbose:
            print("    added title: " + title)

    else:
        font = aggdraw.Font(
            "blue",
            "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf",
            size=16)
        dc.add_text(dateS + "\n" + "MSG-" + str(sat_nr - 7) + " SEVIRI\n" +
                    rgb.replace("_", " ") + "\n")

    return PIL_image
示例#17
0
class evolve(evolve_base):
    font = aggdraw.Font("white", "./fonts/calibrib.ttf", 56)

    text_english = [
        u"Where walls once existed, seeds are planted", u"and a tree grows."
    ]
    text_spanish = [
        u"En donde las paredes alguna vez existieron,",
        u"las semillas se plantan y un \u00e1rbol crece."
    ]

    phrase1 = {
        languages.ENGLISH:
        [Phrases().makeImage_runnable(text_english, font, 60), 1.0],
        languages.SPANISH: [
            Phrases().makeImage_runnable(text_spanish, font, 60),
            Helpers.getLetterRatio(text_english, text_spanish)
        ]
    }

    text_english = [
        u"This tree, our", u"metaphor for", u"sustainability,",
        u"symbolizes our", u"work."
    ]
    text_spanish = [
        u"Este \u00e1rbol,",
        u"simboliza nuestro",
        u"trabajo y nuestra",
        u"met\u00e1fora de",
        u"sustentabilidad.",
    ]

    phrase2 = {
        languages.ENGLISH:
        [Phrases().makeImage_runnable(text_english, font, 60), 1.0],
        languages.SPANISH: [
            Phrases().makeImage_runnable(text_spanish, font, 60),
            Helpers.getLetterRatio(text_english, text_spanish)
        ]
    }

    def __init__(self, start):
        self.startTime = start
        self.stopTime = start + 340
        self.list = []
        self.list.append(seeding(start))
        self.list.append(watering(start + 50))
        self.list.append(growing(start + 100))
        self.list.append(text(start + 80, 70, 50, self.phrase1))
        self.list.append(text(start + 200, 70, 50, self.phrase2))
        self.list.append(
            Transitions.pageFlip(
                Image.open("./images/base7.png"),
                Image.open("./images/base10.png").convert("RGBA"), start + 320,
                20))
示例#18
0
 def __init__(self, message, product, volcview_band, product_label):
     debug_on()
     self.message = message
     self.product = product
     self.product_label = product_label
     self.volcview_band = volcview_band
     self.data = message.data
     self.color_bar_font = aggdraw.Font(GOLDENROD, TYPEFACE, size=FONT_SIZE)
     self.scene = self._create_scene()
     context = zmq.Context()
     self.publisher = context.socket(zmq.PUB)
     self.publisher.connect(SECTOR_PROXY)
示例#19
0
def test_style_retention():
    from PIL import Image
    from pydecorate import DecoratorAGG
    import aggdraw
    from trollimage.colormap import rdbu

    font = aggdraw.Font("navy", "pydecorate/fonts/DejaVuSerif.ttf", size=20)
    font_scale = aggdraw.Font("black",
                              "pydecorate/fonts/DejaVuSerif.ttf",
                              size=12)

    rdbu.colors = rdbu.colors[::-1]
    rdbu.set_range(-90, 10)

    img = Image.open('BMNG_clouds_201109181715_areaT2.png')
    dc = DecoratorAGG(img)

    #dc.write_vertically()
    #dc.add_logo("logos/pytroll_light_big.png")
    #dc.add_logo("logos/NASA_Logo.gif",margins=[10,10],bg='yellow')
    #dc.add_logo("logos/pytroll_light_big.png")
    font = aggdraw.Font("blue", "pydecorate/fonts/DejaVuSerif.ttf", size=16)
    #dc.add_text("Some text",font=font)

    #dc.align_right()
    dc.add_scale(rdbu, extend=True, tick_marks=5.0, line_opacity=100, unit='K')

    #dc.align_bottom()
    #dc.add_scale(rdbu, extend=True, tick_marks=2.0, line_opacity=100, width=60)

    #dc.align_right()
    #dc.write_vertically()
    dc.align_bottom()
    dc.add_scale(rdbu, extend=True, tick_marks=5.0, line_opacity=100, unit='K')

    #dc.align_left()
    #dc.add_scale(rdbu, extend=True, font=font_scale, tick_marks=2.0, minor_tick_marks=1.0, line_opacity=100, width=60, unit='K')

    # img.show()
    img.save("style_retention.png")
示例#20
0
 def getPhrase31(i):
     image = Image.new("L", (1150, 205), "black")
     d = aggdraw.Draw(image)
     font = aggdraw.Font("white", "adler.ttf", 36)
     text = ["As the tree grows, it buds splendid new leaves:"]
     offset = 0
     offsetY = 0
     for frag in text:
         d.text((10, offsetY), frag[0:max(i - offset, 0)], font)
         offsetY += 40
         offset += len(frag)
     d.flush()
     return image
示例#21
0
def get_cached_font(fontname, fontsize, color, alpha):
    key = (fontname, fontsize, color, alpha)
    try:
        return font_asst.get_cache(key)

    except KeyError:
        # see if we can build the font
        info = font_asst.get_font_info(fontname, subst_ok=True)

        font = agg.Font(color, info.font_path, size=fontsize, opacity=alpha)
        font_asst.add_cache(key, font)

        return font
示例#22
0
class evolve(evolve_base):
    font = aggdraw.Font("white", "./fonts/calibri.ttf", 46)
    text_english = [u"CITIZENS THRIVE IN COLLABORATION"]
    text_spanish = [u"CIUDADANOS PROPSERAN EN COLABORACI\u00d3N"]

    phrase1 = {
        languages.ENGLISH:
        Phrases().makeImage_centered_runnable(text_english, font),
        languages.SPANISH:
        Phrases().makeImage_centered_runnable(text_spanish, font)
    }

    font = aggdraw.Font("white", "./fonts/calibri.ttf", 26)
    text_english = [
        u"Background song \"Learn to Live With What You're Not\" by Steve",
        u"Combs has been slightly edited and available for public sharing and",
        u"adaptation from freemusicarchive.org under an Adaptation license."
    ]
    text_spanish = [
        u"Canci\u00f3n en el fondo \"Learn to Live With What You're Not\" por Steve Combs ha sido",
        u"ligeramente editada y est\u00e1 disponible para compartirse p\u00fablicamente y adaptada por",
        u"Freemusicarchive.org bajo una Licencia de adaptacion."
    ]

    phrase2 = {
        languages.ENGLISH:
        Phrases().makeImage_centered_runnable(text_english, font),
        languages.SPANISH:
        Phrases().makeImage_centered_runnable(text_spanish, font)
    }

    def __init__(self, start):
        self.startTime = start
        self.stopTime = start + 200
        self.list = []
        self.list.append(still(start))
        self.list.append(text(start, 200, self.phrase1, 460))
        self.list.append(text(start, 200, self.phrase2, 580))
示例#23
0
 def getPhrase29(i):
     image = Image.new("L", (1150, 205), "black")
     d = aggdraw.Draw(image)
     font = aggdraw.Font("white", "adler.ttf", 36)
     text = ["Where walls once existed, seeds have been planted"]
     text.append("and a tree grows.")
     offset = 0
     offsetY = 0
     for frag in text:
         d.text((10, offsetY), frag[0:max(i - offset, 0)], font)
         offsetY += 40
         offset += len(frag)
     d.flush()
     return image
示例#24
0
 def getPhrase46(i):
     image = Image.new("L", (1150, 405), "black")
     d = aggdraw.Draw(image)
     font = aggdraw.Font("white", "adler.ttf", 36)
     text = ["Still, as of May 2016, our tree is not strong enough"]
     text.append("to bear fruit. The foundation remains weak.")
     offset = 0
     offsetY = 0
     for frag in text:
         d.text((10, offsetY), frag[0:max(i - offset, 0)], font)
         offsetY += 40
         offset += len(frag)
     d.flush()
     return image
示例#25
0
 def zipper(self, a, b):
     font = aggdraw.Font("white", "./fonts/sans.ttf", 28)
     phrases = Phrases()
     retArray = []
     for pos, texts in zip(a, b):
         l_dict = {}
         if texts == None:
             retArray.append([pos, None])
         else:
             for language in languages.list_of_languages:
                 l_dict[language] = phrases.makeImage_centered(
                     texts[language], font)
             retArray.append([pos, l_dict])
     return retArray
示例#26
0
 def getPhrase30(i):
     image = Image.new("L", (1150, 205), "black")
     d = aggdraw.Draw(image)
     font = aggdraw.Font("white", "adler.ttf", 36)
     text = ["This tree, a metaphor for sustainable life,"]
     text.append("symbolizes our movement's work.")
     offset = 0
     offsetY = 0
     for frag in text:
         d.text((10, offsetY), frag[0:max(i - offset, 0)], font)
         offsetY += 40
         offset += len(frag)
     d.flush()
     return image
示例#27
0
 def getPhrase52(i):
     image = Image.new("L", (1150, 605), "black")
     d = aggdraw.Draw(image)
     font = aggdraw.Font("white", "./fonts/calibri.ttf", 46)
     text = ["Narrative development program"]
     text.append("for the Network's women leaders.")
     offset = 0
     offsetY = 0
     for frag in text:
         d.text((10, offsetY), frag[0:max(i - offset, 0)], font)
         offsetY += 50
         offset += len(frag)
     d.flush()
     return image
示例#28
0
 def getPhrase55(i):
     image = Image.new("L", (790, 160), "black")
     d = aggdraw.Draw(image)
     font = aggdraw.Font("white", "./fonts/calibrib.ttf", 46)
     text = []
     text.append("www.psydeh.com")
     offset = 0
     offsetY = 0
     for frag in text:
         d.text((10, offsetY), frag[0:max(i - offset, 0)], font)
         offsetY += 50
         offset += len(frag)
     d.flush()
     return image
示例#29
0
 def getPhrase50(i):
     image = Image.new("L", (1150, 605), "black")
     d = aggdraw.Draw(image)
     font = aggdraw.Font("white", "./fonts/calibri.ttf", 46)
     text = ["Five new local projects by the Umbrella"]
     text.append("Network's women-led organizations.")
     offset = 0
     offsetY = 0
     for frag in text:
         d.text((10, offsetY), frag[0:max(i - offset, 0)], font)
         offsetY += 50
         offset += len(frag)
     d.flush()
     return image
示例#30
0
 def getPhrase51(i):
     image = Image.new("L", (1150, 605), "black")
     d = aggdraw.Draw(image)
     font = aggdraw.Font("white", "./fonts/calibri.ttf", 46)
     text = ["Training program for the Regional"]
     text.append("Cooperative of Indigenous Artisans.")
     offset = 0
     offsetY = 0
     for frag in text:
         d.text((10, offsetY), frag[0:max(i - offset, 0)], font)
         offsetY += 50
         offset += len(frag)
     d.flush()
     return image