max 128 inventory images
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
#
|
||||
# Example command: ./generate-items.py /home/`whoami`/Nextcloud/gynkhana/items/ ../gymkhana/items/inventory/ turno_cocina
|
||||
#
|
||||
import shutil, sys, glob, os, math
|
||||
from pathlib import Path
|
||||
from PIL import Image
|
||||
@@ -46,8 +49,15 @@ def generateImage(inputFile, baseName):
|
||||
|
||||
|
||||
originalImage = Image.open(inputFile)
|
||||
scale = 0.15
|
||||
newImage = originalImage.resize((math.ceil(originalImage.width * scale),math.ceil(originalImage.height * scale)))
|
||||
|
||||
biggerSide = originalImage.width
|
||||
if(originalImage.width < originalImage.height):
|
||||
biggerSide = originalImage.height
|
||||
|
||||
scale = 128 / biggerSide
|
||||
|
||||
#scale = 0.15
|
||||
newImage = originalImage.resize((math.floor(originalImage.width * scale),math.floor(originalImage.height * scale)))
|
||||
newImageOutputPath = outputDir + "assets/" + baseName + ".png"
|
||||
print(f"{bcolors.OKCYAN}Image:{bcolors.ENDC} {newImageOutputPath} {bcolors.OKGREEN}generated.{bcolors.ENDC}")
|
||||
newImage.save(newImageOutputPath)
|
||||
|
||||
Reference in New Issue
Block a user