Loading

colour filtering shit

  1. import os
  2. from os import remove
  3. from PIL import Image
  4.  
  5. diskPath = "D:/_FACTORIO/circuit-connector-module/"
  6. inputFolder = "03_Ae/Ae-OUTPUT/Shiftings/"
  7. outputFolder = "04_Python-spritesheeterInput/Shiftings/"
  8. entityName = "_ENTITY-shiftings-ACCUMULATOR"
  9.  
  10. def filterStuff(inputImage, frameNumber):
  11.   shiftingImage = diskPath + inputFolder + inputImage+ "/" + inputImage + frameNumber + ".png"
  12.   i = Image.open(shiftingImage)
  13.  
  14.   newImageRed = Image.new("RGBA", (i.width,i.height), color=(0,0,0,0))
  15.   newImageBlue = Image.new("RGBA", (i.width,i.height), color=(0,0,0,0))
  16.  
  17.   for x in range(0, i.width):
  18.     for y in range(0, i.height):
  19.       pix = i.getpixel((x,y))
  20.       if pix[0] == 255:
  21.         newImageRed.putpixel((x,y),pix)
  22.       if pix[2] == 255:
  23.         newImageBlue.putpixel((x,y),pix)
  24.   os.makedirs(diskPath + outputFolder + inputImage + frameNumber + "/" , exist_ok = True)
  25.   newImageRed.save(diskPath + outputFolder + inputImage + frameNumber + "/" + inputImage + frameNumber + "_boxShifting.png")
  26.   newImageBlue.save(diskPath + outputFolder + inputImage + frameNumber + "/" + inputImage + frameNumber + "_shadowShifting.png")
  27.  
  28. def run():
  29.   filterStuff("_ENTITY-shiftings-ACCUMULATOR", "_000")
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48. import traceback
  49.  
  50. try:
  51.  
  52.   run()
  53.  
  54. except Exception as e:
  55.  
  56.   traceback.print_exc()
  57.  
  58. input("Press enter to continue...")

Comments