Added Texture Folder + Scripts

This commit is contained in:
Killergnom
2024-03-18 14:42:50 +01:00
parent 5bc0bb5271
commit 44f2a82083
3 changed files with 77 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,34 @@
from unittest import skip
from PIL import Image
import sys
import os
if len(sys.argv) < 1:
print("Please provide the input files.")
sys.exit(1)
inputTexs = sys.argv
if not os.path.exists(os.path.join(os.path.dirname(inputTexs[1]),"optimized")):
os.mkdir(os.path.join(os.path.dirname(inputTexs[1]),"optimized"))
export_path = os.path.join(os.path.dirname(inputTexs[1]),"optimized")
#export_path = os.mkdir(os.path.join(os.path.dirname(inputTexs[1]),"optimized"))
#print (Input_filepath)
#print(inputTexs[1])
for i in range(1,len(inputTexs),1):
currentTex = Image.open(inputTexs[i])
if currentTex.size <= (2048,2048):
print (currentTex + "is already smaller than 2048x2048")
continue
# downsize the image with an LANCZOS filter (gives the highest quality)
resizedTex = currentTex.resize((2048,2048),Image.LANCZOS)
resizedTex.save(str(export_path) + "\\" + os.path.basename(inputTexs[i]), optimize=True, quality=95)
print("Textures successfully resized!")