Ejemplo n.º 1
0
from PIL import Image ##must import Image first to be able to use it
import check2_helper
import panoramio as pan

address = input("Enter an address ==> ")
urls = pan.getPhotos(address,4)

if len(urls)>=4:
    final_im = Image.new("RGB", (512,512), "white") # use mode 'RGB', color 'white'
    im_1 = pan.openphoto(urls[0])
    im_2 = pan.openphoto(urls[1])
    im_3 = pan.openphoto(urls[2])
    im_4 = pan.openphoto(urls[3])

    im_1 = check2_helper.make_square(im_1)
    im_2 = check2_helper.make_square(im_2)
    im_3 = check2_helper.make_square(im_3)
    im_4 = check2_helper.make_square(im_4)

    im_1 = im_1.resize((256,256))
    im_2 = im_2.resize((256,256))
    im_3 = im_3.resize((256,256))
    im_4 = im_4.resize((256,256))

    final_im.paste(im_1,(0,0))
    final_im.paste(im_2,(256,0))
    final_im.paste(im_3,(0,256))
    final_im.paste(im_4,(256,256))

    final_im.show()
else:
from PIL import Image
import panoramio as pan
from check2_helper import make_square

address = raw_input('Type an address ==> ')

urls = pan.getPhotos(address,4)

if len(urls) >= 4:
    
    background = Image.new('RGB', (512,512), 'white')
    
    im1 = pan.openphoto(urls[0])
    im1 = make_square(im1)
    im1 = im1.resize((256,256))
    background.paste(im1,(0,0))
    
    im2 = pan.openphoto(urls[1])
    im2 = make_square(im2)
    im2 = im2.resize((256,256))
    background.paste(im2,(256,0))
    
    im3 = pan.openphoto(urls[2])
    im3 = make_square(im3)
    im3 = im3.resize((256,256))
    background.paste(im3,(0,256))
    
    im4 = pan.openphoto(urls[3])
    im4 = make_square(im4)
    im4 = im4.resize((256,256))
    background.paste(im4,(256,256))
Ejemplo n.º 3
0
import wikimedia
import check2_helper
from PIL import Image

x = input("Search image: ")
images = wikimedia.find_images(x, 4)

if len(images) == 4:
    im = Image.new('RGB', (512, 512), 'white')
    im1 = images[0]
    im1 = check2_helper.make_square(im1)
    im2 = images[1]
    im2 = check2_helper.make_square(im2)
    im3 = images[2]
    im3 = check2_helper.make_square(im3)
    im4 = images[3]
    im4 = check2_helper.make_square(im4)
    im1 = im1.resize((256, 256))
    im2 = im2.resize((256, 256))
    im3 = im3.resize((256, 256))
    im4 = im4.resize((256, 256))
    im.paste(im1, (0, 0))
    im.paste(im2, (0, 256))
    im.paste(im3, (256, 0))
    im.paste(im4, (256, 256))
    im.show()
else:
    print("Could not find a sufficient number of images.")
Ejemplo n.º 4
0
from PIL import Image
from check2_helper import make_square

im = Image.new('RGB', (512, 512), 'white')

im_1 = Image.open('ca.jpg')
im_1 = make_square(im_1)
im_1 = im_1.resize((256, 256))

im_2 = Image.open('im.jpg')
im_2 = make_square(im_2)
im_2 = im_2.resize((256, 256))

im_3 = Image.open('hk.jpg')
im_3 = make_square(im_3)
im_3 = im_3.resize((256, 256))

im_4 = Image.open('bw.jpg')
im_4 = make_square(im_4)
im_4 = im_4.resize((256, 256))

im.paste(im_1, (0, 0))
im.paste(im_2, (256, 0))
im.paste(im_3, (0, 256))
im.paste(im_4, (256, 256))

im.show()
Ejemplo n.º 5
0
from PIL import Image
import check2_helper as help
resize = (512 // 2, 512 // 2)
im = Image.new('RGB', (512, 512), 'white')
im2 = Image.open("ca.jpg")
im3 = Image.open("tr.jpg")
im4 = Image.open("im.jpg")
im5 = Image.open("hk.jpg")
im2v2 = help.make_square(im2)
im3v2 = help.make_square(im3)
im4v2 = help.make_square(im4)
im5v2 = help.make_square(im5)
im.paste(im2v2.resize(resize), (0, 0))
im.paste(im3v2.resize(resize), resize)
im.paste(im4v2.resize(resize), (resize[0], 0))
im.paste(im5v2.resize(resize), (0, resize[1]))
im.show()
Ejemplo n.º 6
0
from PIL import Image
from check2_helper import make_square

imc = Image.open('ca.jpg')
imh = Image.open('hk.jpg')

im = Image.new('RGB',(512,512))
im_ca = make_square(imc)
im_hk = make_square(imh)
im.paste(im_ca, (0,0))
im.paste(im_hk, (256,0))
im.save('two_by_two.jpg')
im.show()