Skip to content

Instantly share code, notes, and snippets.

@vipulgupta2048
Created June 11, 2020 22:17
Show Gist options
  • Select an option

  • Save vipulgupta2048/3d478b8298bd23a47200e0ae56d1dbe6 to your computer and use it in GitHub Desktop.

Select an option

Save vipulgupta2048/3d478b8298bd23a47200e0ae56d1dbe6 to your computer and use it in GitHub Desktop.
Main Code for PartyStarter
from PIL import Image
import os
from helpers import party_saver, party_changer
# Secret RGBA sauce for Party Parrot colors
secret_sauces = [
(255, 107, 107, 255),
(255, 107, 181, 255),
(255, 129, 255, 255),
(208, 129, 255, 255),
(129, 172, 255, 255),
(129, 255, 255, 255),
(129, 255, 129, 255),
(255, 208, 129, 255),
(255, 129, 129, 255),
]
# Initialising the image to run operations
input_image = "image.png"
file, ext = os.path.splitext(os.path.split(input_image)[1])
img = Image.open(input_image)
pixels = img.load()
width, height = img.size
os.system("mkdir output/" + file)
# Frame creation and saving frame of each color
for count, secret_sauce in enumerate(secret_sauces):
party_changer(width, height, pixels, secret_sauce)
img.save(
"/home/vipulgupta2048/party-parrot-creator/output/"
+ file
+ "/"
+ str(count)
+ ext,
ext[1:],
)
party_saver(file)
print("Party done for {}".format(file))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment