Mix.install([
{:image, "~> 0.28.0"},
{:tesla, "~> 1.6"},
{:kino, "~> 0.9.2"}
])
urls = [
"https://cdn.tontontresors.com/1/1-1789-1-s120.jpg",
"https://cdn.tontontresors.com/2/2-1821-5-s120.jpg",
"https://cdn.tontontresors.com/4/4-24-faubourg-7-s120.jpg",
"https://cdn.tontontresors.com/5/5-24-faubourg-seconde-10-s120.jpg",
"https://cdn.tontontresors.com/6/6-24-heures-du-mans-11-s120.jpg",
"https://cdn.tontontresors.com/8/8-a-chacun-son-cheval-15-s120.jpg",
"https://cdn.tontontresors.com/9/9-a-cheval-sur-mon-carre-19-s120.jpg",
"https://cdn.tontontresors.com/10/10-a-contre-courant-24-s120.jpg",
"https://cdn.tontontresors.com/11/11-a-cor-et-a-cri-27-s120.jpg",
"https://cdn.tontontresors.com/12/12-a-garden-of-shapes-30-s120.jpg",
"https://cdn.tontontresors.com/13/13-a-l-ombre-des-boulevards-31-s120.jpg",
"https://cdn.tontontresors.com/15/15-a-la-fenetre-du-chasseur-35-s120.jpg",
"https://cdn.tontontresors.com/16/16-a-la-gloire-de-guillaume-41-s120.jpg",
"https://cdn.tontontresors.com/17/17-a-la-gloire-de-la-cuisine-francaise-45-s120.jpg",
"https://cdn.tontontresors.com/18/18-a-la-gloire-de-la-legion-etrangere-46-s120.jpg",
"https://cdn.tontontresors.com/21/21-a-la-gloire-de-la-legion-etrangere-47-s120.jpg",
"https://cdn.tontontresors.com/22/22-a-la-gloire-des-bataillons-de-chasseurs-50-s120.jpg",
"https://cdn.tontontresors.com/23/23-a-la-plume-53-s120.jpg",
"https://cdn.tontontresors.com/24/24-a-propos-de-bottes-59-s120.jpg",
"https://cdn.tontontresors.com/25/25-a-travers-champs-65-s120.jpg",
"https://cdn.tontontresors.com/26/26-a-vos-crayons-66-s120.jpg",
"https://cdn.tontontresors.com/27/27-a-votre-service-69-s120.jpg",
"https://cdn.tontontresors.com/28/28-a-walk-in-the-park-72-s120.jpg",
"https://cdn.tontontresors.com/29/29-abecedaire-73-s120.jpg",
"https://cdn.tontontresors.com/32/32-acte-iii-scene-i-la-clairiere-74-s120.jpg",
"https://cdn.tontontresors.com/33/33-africa-80-s120.jpg",
"https://cdn.tontontresors.com/34/34-les-ailes-de-la-soie-82-s120.jpg",
"https://cdn.tontontresors.com/36/36-les-ailes-pleine-de-joie-85-s120.jpg",
"https://cdn.tontontresors.com/37/37-l-air-marin-87-s120.jpg",
"https://cdn.tontontresors.com/38/38-aladin-91-s120.jpg",
"https://cdn.tontontresors.com/71/71-albums-de-colportage-123-s120.jpg",
"https://cdn.tontontresors.com/72/72-alfred-de-dreux---peintre-du-cheval-124-s120.jpg",
"https://cdn.tontontresors.com/73/73-ali-baba-130-s120.jpg",
"https://cdn.tontontresors.com/74/74-alliances-du-monde-131-s120.jpg",
"https://cdn.tontontresors.com/76/76-les-allures-134-s120.jpg",
"https://cdn.tontontresors.com/78/78-les-allures-du-cheval-1-136-s120.jpg",
"https://cdn.tontontresors.com/79/79-aloha-138-s120.jpg",
"https://cdn.tontontresors.com/80/80-l-alphabet-des-metiers-142-s120.jpg",
"https://cdn.tontontresors.com/81/81-alphabet-iii-145-s120.jpg",
"https://cdn.tontontresors.com/113/113-alphabet-russe-193-s120.jpg",
"https://cdn.tontontresors.com/114/114-alsace-enseigne-195-s120.jpg",
"https://cdn.tontontresors.com/115/115-alternateur-196-s120.jpg",
"https://cdn.tontontresors.com/116/116-amazones-i-200-s120.jpg",
"https://cdn.tontontresors.com/117/117-les-amazones-ii-203-s120.jpg",
"https://cdn.tontontresors.com/118/118-les-amazones-iii-206-s120.jpg",
"https://cdn.tontontresors.com/119/119-amazonia-208-s120.jpg",
"https://cdn.tontontresors.com/120/120-les-amoureux-de-paris-214-s120.jpg",
"https://cdn.tontontresors.com/121/121-amours-217-s120.jpg",
"https://cdn.tontontresors.com/122/122-les-amours-219-s120.jpg",
"https://cdn.tontontresors.com/123/123-les-ancetres-220-s120.jpg"
]
images =
Enum.map(urls, fn url ->
%{body: bin} = Tesla.get!(url)
{:ok, img} =
bin
|> IO.iodata_to_binary()
|> Vix.Vips.Image.new_from_buffer()
img
end)
|> Enum.filter(fn image ->
w = Vix.Vips.Image.width(image)
h = Vix.Vips.Image.height(image)
w == h
end)
Vix.Vips.Operation.arrayjoin!(images, across: 8, background: [255, 255, 255])