max 128 inventory images
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 21 KiB |
@@ -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)
|
||||
|
||||