Skip to content

Can't convert PNG transparent #1

@maclovin

Description

@maclovin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions