Skip to content

Instantly share code, notes, and snippets.

@rozanecm
Created August 24, 2021 12:28
Show Gist options
  • Save rozanecm/d78660733c9e02c2ab11b28c283f7e8e to your computer and use it in GitHub Desktop.
Save rozanecm/d78660733c9e02c2ab11b28c283f7e8e to your computer and use it in GitHub Desktop.
import os
from PIL import Image
base_path = ""
setp = 5
for i in range(1750000, 1750983, step):
path_img1 = os.path.join(base_path, "Data" + str(i) + ".png")
path_img2 = os.path.join(base_path, "Data" + str(i+step) + ".png")
image1 = Image.open(path_img1)
image2 = Image.open(path_img2)
new_image = Image.new('RGB',(2*image1.size[0], image1.size[1]), (250,250,250))
new_image.paste(image1,(0,0))
new_image.paste(image2,(image1.size[0],0))
new_image.save(os.path.join(base_path, "paired skipping", str(i) + ".png"),"PNG")
import os
from PIL import Image
base_path = ""
setp = 5
for i in range(1750000, 1750983, step):
path_img1 = os.path.join(base_path, "Data" + str(i) + ".png")
path_img2 = os.path.join(base_path, "Data" + str(i+step) + ".png")
image1 = Image.open(path_img1)
image2 = Image.open(path_img2)
new_image = Image.new('RGB',(2*image1.size[0], image1.size[1]), (250,250,250))
new_image.paste(image1,(0,0))
new_image.paste(image2,(image1.size[0],0))
new_image.save(os.path.join(base_path, "paired skipping", str(i) + ".png"),"PNG")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment