Пример #1
0
    import photobot as pb

if kwdbg:
    # make random choices repeatable for debugging
    rnd.seed(8)

imagewell = pb.loadImageWell(resultfile="imagewell-files")
tiles = imagewell['landscape']
rnd.shuffle(tiles)

# pick 2 images
img1path = tiles.pop()
img2path = tiles.pop()

# create a white canvas
c = pb.canvas(WIDTH, HEIGHT)
c.fill((192, 192, 192))

#
# Image 1
#

#  create, scale and place the image
x, y = 10, 10
top, w1, h1 = pb.placeImage(c, img1path, x, y, 256, "Image 1")
pb.label(c, "Image 1", x, y)

#
# Image 2
#
x, y = w1 + 20, 10
Пример #2
0
    WIDTH, HEIGHT = W, H
    import photobot as pb

if kwdbg:
    # make random choices repeatable for debugging
    rnd.seed(8)

imagewell = pb.loadImageWell(resultfile="imagewell-files")
tiles = imagewell['landscape']
rnd.shuffle(tiles)

img1path = tiles.pop()
img2path = tiles.pop()

# create the canvas
c = pb.canvas(int(WIDTH), int(HEIGHT))
c.fill((255, 255, 255))

imsize = int((WIDTH - 30) / 2)
x, y = 10, 10
img1, w1, h1 = pb.placeImage(c, img1path, x, y, imsize, "image1")
pb.label(c, "Original Image", x, y)

#
# flip horizontal
#
c.layers["image1"].duplicate()
c.top.name = "flip1"

x, y = w1 + 20, 10
c.top.translate(x, y)
Пример #3
0
# pdb.set_trace()
#
done = False

while not done:

    pagename = "%s-%s" % (pagebasename, str(pagenr).rjust(3, "0"))
    print()
    print(pagename)

    x0 = insettop
    y0 = insetleft

    # fill a page
    c = pb.canvas(pagewidth, pageheight)
    c.fill((233, 233, 233))
    debugcanvas(c)

    pageitems = 0

    g = grid(columns, rows, cellwidth, cellheight, gutter)

    for x, y in g:
        x += x0
        y += y0
        x = int(round(x))
        y = int(round(y))
        try:
            img = tiles.pop(0)
            print((x, y, img.encode("utf-8")))