mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-16 21:17:39 +03:00
* the definition of insanity * the definition of insanity * the definition of insanity * we have hullrot at home * maybe the real hullrot was the friends we made along the way * john hullrot * i am going to hullroooooot * it's hullrotver * we're so hullback * we're rotting the hull with this one * hullmerge * the hullrot is leaking * never gonna rot you up * hullfresh * john starsector * god i wish we had grid collision damage * you can tell I am very tired because I stopped forcing a hullrot joke into every commit message * hr * this is a surprise sprite that will help us later * motherfucker * i have nothing good to say * still nothing * brb * random letter random letter random letter dash random number random number random number * ass * blast * ffs * fcuk * RE: ffs * RE: RE: ffs * гнида жестяная * continue * i hate tests * i love tests * slide to the right * i hate tests again * what the fuck * ты шиз? * ?? * bbgun
64 lines
1.6 KiB
Python
64 lines
1.6 KiB
Python
from PIL import Image
|
|
import os, sys
|
|
|
|
path = os.getcwd()
|
|
basefile = "dollymix"
|
|
ext = ".png"
|
|
size = int(input("size: "))
|
|
reverse = size > 0
|
|
size = abs(size)
|
|
|
|
|
|
base = Image.open(os.path.join(path,basefile+ext))
|
|
amount = base.height // size
|
|
|
|
states = []
|
|
|
|
for i in range(amount):
|
|
name = basefile+str(i+1)
|
|
filename = name+ext
|
|
states.append(name)
|
|
print(filename)
|
|
if(reverse):
|
|
base.crop((0,size*(amount-1-i),base.width,size*(amount-i))).save(os.path.join(path,filename))
|
|
else:
|
|
base.crop((0,size*i,base.width,size*(i+1))).save(os.path.join(path,filename))
|
|
|
|
unshadedfile = os.path.join(path,basefile+"-unshaded"+ext)
|
|
if os.path.exists(unshadedfile):
|
|
base = Image.open(unshadedfile)
|
|
amount = base.height // size
|
|
|
|
for i in range(amount):
|
|
name = basefile+str(i+1)+"-unshaded"
|
|
filename = name+ext
|
|
states.append(name)
|
|
print(filename)
|
|
if(reverse):
|
|
base.crop((0,size*(amount-1-i),base.width,size*(amount-i))).save(os.path.join(path,filename))
|
|
else:
|
|
base.crop((0,size*i,base.width,size*(i+1))).save(os.path.join(path,filename))
|
|
|
|
if(len(states) == 0):
|
|
exit(1)
|
|
|
|
metaheader = """{
|
|
"version": 1,
|
|
"license": "CC-BY-SA-3.0",
|
|
"copyright": "WWDP autogenerated",
|
|
"size": {
|
|
"x": 32,
|
|
"y": 32
|
|
},
|
|
"states": [
|
|
"""
|
|
metaentry = """ {{ "name": "{0}" }}"""
|
|
metaterm = """
|
|
]
|
|
}"""
|
|
|
|
states.append("icon")
|
|
with open(os.path.join(path,"meta.json"), 'w') as metajson:
|
|
metajson.write(metaheader)
|
|
metajson.write(",\n".join([metaentry.format(state) for state in states]))
|
|
metajson.write(metaterm) |