# 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", 0) pb.label(c, "Image 1", x, y) # # Image 2 # x, y = w1 + 20, 10 top, w2, h2 = pb.placeImage(c, img2path, x, y, 256, "Image 2", 1) pb.label(c, "Image 2", x, y) # # Difference Images 1 & 2 # h = max(h1, h2) x, y = 10, h + 20
c = pb.canvas(WIDTH, HEIGHT) c.fill((192, 192, 192)) # # Image 1 # _, filename = os.path.split(img1path) # create, scale and place the image x, y = 10, 10 img1, w1, h1 = pb.placeImage(c, img1path, x, y, 380, "Image 1 Base") c.layers[img1].duplicate() c.top.autocontrast(cutoff=0) pb.label(c, "%s autocontrast: 0" % filename, x, y) # # Image 2 # c.layers[img1].duplicate() c.top.autocontrast(cutoff=5) x, y = w1 + 20, 10 c.top.translate(x, y) pb.label(c, "%s autocontrast: 5" % filename, x, y) # # Image 3 # c.layers[img1].duplicate()
# pick 2 images img1path = tiles.pop() img2path = tiles.pop() # create a gray 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 top, w2, h2 = pb.placeImage(c, img2path, x, y, 256, "Image 2") pb.label(c, "Image 2", x, y) # # Screen Images 1 & 2 # h = max(h1, h2) x, y = 10 , h + 20
img1path = tiles.pop() img2path = tiles.pop() # create a white canvas c = pb.canvas(WIDTH, HEIGHT) c.fill((192, 192, 192)) # # Image 1 # print(img1path.encode("utf-8")) # create, scale and place the image x, y = 10, 10 top, w1, h1 = pb.placeImage(c, img1path, x, y, 512, "Image 1") pb.label(c, "Image 1", x, y, 30) x, y = 10, h1 + 10 + 10 top, w1, h1 = pb.placeImage(c, img1path, x, y, 512, "Image 1 colored") # apply colorize # c.top.colorize((192, 120, 0), (240, 255, 127)) c.top.colorize(black=(60, 60, 0), white=(250, 200, 96), mid=(220, 190, 16)) pb.label(c, "Image 1 colored", x, y, 30) # draw the result c.draw(name="Layer_function_colorize")
# 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 img1, w1, h1 = pb.placeImage(c, img1path, x, y, 256, "Image 1") pb.label(c, "Image 1 Opacity: 100", x, y) # # Image 2 # c.layers[img1].duplicate() c.top.name = "Image 2" c.top.opacity(80) x, y = w1 + 20, 10 c.top.translate(x, y) pb.label(c, "Image 2 Opacity: 80", x, y) # # Image 3 #
# 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 top, w2, h2 = pb.placeImage(c, img2path, x, y, 256, "Image 2") pb.label(c, "Image 2", x, y) # # Color Images 1 & 2 # h = max(h1, h2) x, y = 10, h + 20
# 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 # _, fname = os.path.split(img1path) # create, scale and place the image x, y = 10, 10 top, w1, h1 = pb.placeImage(c, img1path, x, y, 522, fname) pb.label(c, fname, x, y) # # Image 2 # x, y = 10, 10 + h1 + 10 top, w2, h2 = pb.placeImage(c, img1path, x, y, 522, fname) c.layers[top].emboss() pb.label(c, "%s emboss()" % fname, x, y) # draw the result c.draw(name="Layer_function_emboss")
# 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 top, w2, h2 = pb.placeImage(c, img2path, x, y, 256, "Image 2") pb.label(c, "Image 2", x, y) yskip = max(h1, h2) # # Add Images 1 & 2 # x, y = 10, 1 * (yskip + 20)
c = pb.canvas(WIDTH, HEIGHT) c.fill((192, 192, 192)) # # Image 1 # _, filename = os.path.split(img1path) # create, scale and place the image x, y = 10, 10 img1, w1, h1 = pb.placeImage(c, img1path, x, y, 256, "Image 1 Base") c.layers[img1].duplicate() c.top.posterize(8) pb.label(c, "%s posterize: None" % filename, x, y) # # Image 2 # c.layers[img1].duplicate() c.top.posterize(7) x, y = w1 + 20, 10 c.top.translate(x, y) pb.label(c, "%s posterize: 7" % filename, x, y) # # Image 3 # c.layers[img1].duplicate()
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 _, w1, h1 = pb.placeImage(c, img1path, x, y, 192, "Image 1", width=True) pb.label(c, "Image 1", x, y) # # Image 2 # x, y = w1+20, 10 _, w2, h2 = pb.placeImage(c, img2path, x, y, 192, "Image 2", width=True) pb.label(c, "Image 2", x, y) # # Mask Images 1 & 2 # h = max(h1, h2)
pb = ximport("photobot") else: WIDTH, HEIGHT = W, H import photobot as pb # create the canvas c = pb.canvas(WIDTH, HEIGHT) c.fill((210, 210, 10)) # the gradients # SOLID grad1idx = c.gradient(pb.SOLID, 180, 180) c.top.translate(10, 10) pb.label(c, "SOLID", 10, 10, 26) # LINEAR grad2idx = c.gradient(pb.LINEAR, 180, 180) c.top.translate(200, 10) pb.label(c, "LINEAR", 200, 10, 26) # RADIAL grad3idx = c.gradient(pb.RADIAL, 180, 180) c.top.translate(390, 10) pb.label(c, "RADIAL", 390, 10, 26) # DIAMOND grad4idx = c.gradient(pb.DIAMOND, 180, 180) c.top.translate(580, 10) pb.label(c, "DIAMOND", 580, 10, 26)
c = pb.canvas(WIDTH, HEIGHT) c.fill((192, 192, 192)) # # Image 1 # _, filename = os.path.split(img1path) # create, scale and place the image x, y = 10, 10 img1, w1, h1 = pb.placeImage(c, img1path, x, y, 380, "Image 1 Base") c.layers[img1].duplicate() c.top.solarize(256) pb.label(c, "%s solarize: 256" % filename, x, y) # # Image 2 # c.layers[img1].duplicate() c.top.solarize(224) x, y = w1 + 20, 10 c.top.translate(x, y) pb.label(c, "%s solarize: 224" % filename, x, y) # # Image 3 # c.layers[img1].duplicate()
# 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 top, w2, h2 = pb.placeImage(c, img2path, x, y, 256, "Image 2") pb.label(c, "Image 2", x, y) # # Hue Images 1 & 2 # h = max(h1, h2) x, y = 10, h + 20
# 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 # _, fname = os.path.split(img1path) # create, scale and place the image x, y = 10, 10 top, w1, h1 = pb.placeImage(c, img1path, x, y, 522, fname) pb.label(c, fname, x, y) # # Image 2 # x, y = 10, 10 + h1 + 10 top, w2, h2 = pb.placeImage(c, img1path, x, y, 522, fname) c.layers[top].contour() pb.label(c, "%s contour()" % fname, x, y) # draw the result c.draw(name="Layer_function_contour")
# 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 img1, w1, h1 = pb.placeImage(c, img1path, x, y, 256, "Image 1") pb.label(c, "Image 1 Contrast: 100", x, y) # # Image 2 # c.layers[img1].duplicate() c.top.name = "Image 2" c.top.contrast(80) x, y = w1 + 20, 10 c.top.translate(x, y) pb.label(c, "Image 2 Contrast: 80", x, y) # # Image 3 #
# pick 2 images img1path = tiles.pop() img2path = tiles.pop() # create a gray 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 top, w2, h2 = pb.placeImage(c, img2path, x, y, 256, "Image 2") pb.label(c, "Image 2", x, y) # # Subtract Images 1 & 2 # h = max(h1, h2) x, y = 10, h + 20
# pick 2 images img1path = tiles.pop() img2path = tiles.pop() # create a gray 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, tilewidth, "Image 1") pb.label(c, "Image 1", x, y) # # Image 2 # x, y = w1 + 20, 10 top, w2, h2 = pb.placeImage(c, img2path, x, y, tilewidth, "Image 2") pb.label(c, "Image 2", x, y) # # Overlay Images 1 & 2 # h = max(h1, h2) x, y = 10, h + 20
# 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 # _, fname = os.path.split(img1path) # create, scale and place the image x, y = 10, 10 top, w1, h1 = pb.placeImage(c, img1path, x, y, 522, fname) pb.label(c, fname, x, y) # # Image 2 # x, y = 10, 10 + h1 + 10 top, w2, h2 = pb.placeImage(c, img1path, x, y, 522, fname) c.layers[top].edge_enhance_more() pb.label(c, "%s edge_enhance_more()" % fname, x, y) # draw the result c.draw(name="Layer_function_enhance_more")
# 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 # _, fname = os.path.split(img1path) # create, scale and place the image x, y = 10, 10 top, w1, h1 = pb.placeImage(c, img1path, x, y, 522, fname) pb.label(c, fname, x, y) # # Image 2 # x, y = 10, 10 + h1 + 10 top, w2, h2 = pb.placeImage(c, img1path, x, y, 522, fname) c.layers[top].boxblur(4) pb.label(c, "%s boxblur(4)" % fname, x, y) # draw the result c.draw(name="Layer_function_boxblur")
# create a gray canvas c = pb.canvas(WIDTH, HEIGHT) c.fill((192, 192, 192)) # # Image 1 # _, filename = os.path.split(img1path) # create, scale and place the image x, y = 10, 10 img1, w1, h1 = pb.placeImage(c, img1path, x, y, WIDTH - 20, "Image 1 Base") c.top.autocontrast(cutoff=0) pb.label(c, filename, x, y) # # Image 2 # c.layers[img1].duplicate() path = ((w1 / 2, 0), (w1, int(h1 * 0.667)), (w1 / 2.0, h1), (0, h1 * 0.75), (0, h1 / 2)) c.top.select(path) x, y = 10, h1 + 20 + 10 c.top.translate(x, y) # draw the result c.draw(name="Layer_function_select")
# 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 top, w2, h2 = pb.placeImage(c, img2path, x, y, 256, "Image 2") pb.label(c, "Image 2", x, y) # # Multiply Images 1 & 2 # h = max(h1, h2) x, y = 10, h + 20
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) c.top.flip(pb.HORIZONTAL) pb.label(c, "Horizontal Flip", x, y) # # flip vertical #
img2path = tiles.pop() # create a white canvas c = pb.canvas( WIDTH, HEIGHT) c.fill( (192, 192, 192) ) # # Image 1 # _, fname = os.path.split( img1path ) # create, scale and place the image x, y = 10, 10 top, w1, h1 = pb.placeImage(c, img1path, x, y, 522, fname) pb.label(c, fname, x, y) # # Image 2 # x, y = 10, 10 + h1 + 10 top, w2, h2 = pb.placeImage(c, img1path, x, y, 522, fname) c.top.find_edges() pb.label(c, "%s find_edges()" % fname, x, y) # draw the result c.draw(name="Layer_function_find_edges")