asahala/Bitcrush

Can't convert PNG transparent

Opened this issue · 0 comments

I've been trying to convert some texture files (PNG with transparency) but there's some issues with conversion from transparent pixel to desired pixel recolour.

Theres the script output:

$ python3 main.py -f DOOM2/AGB128_1.png -m CGA
Traceback (most recent call last):
  File "/Users/thx1139/lab/Bitcrush/main.py", line 125, in <module>
    main()
  File "/Users/thx1139/lab/Bitcrush/main.py", line 120, in main
    commandline_process(fname, args)
  File "/Users/thx1139/lab/Bitcrush/main.py", line 93, in commandline_process
    img.adjust(args.adjust[0], args.adjust[1])
  File "/Users/thx1139/lab/Bitcrush/bitcrush.py", line 105, in adjust
    i = ImageEnhance.Brightness(img).enhance(b_factor)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PIL/ImageEnhance.py", line 36, in enhance
    return Image.blend(self.degenerate, self.image, factor)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PIL/Image.py", line 3067, in blend
    return im1._new(core.blend(im1.im, im2.im, alpha))
ValueError: image has wrong mode