UnsignedArduino / Image-to-MakeCode-Arcade

Converts an image or a GIF to a MakeCode Arcade image / array!
6 stars 1 forks source link

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' #1

Open Brohann3214 opened 10 months ago

Brohann3214 commented 10 months ago

Hey UnsignedArduino! I keep getting this error and it is getting really frustrating. here is the full error thingy Arguments received: Namespace(input=PosixPath('catty.png'), output=None, preview=True, width=None, height=None, palette='#000000,#ffffff,#ff2121,#ff93c4,#ff8135,#fff609,#249ca3,#78dc52,#003fad,#87f2ff,#8e2ec4,#a4839f,#5c406c,#e5cdc4,#91463d,#000000', gif=False) Opening image /Users/mynamehere/Documents/GitHub/Image-to-MakeCode-Arcade/catty.png Size: 400x400 Width and height were not specified, defaulting to width of 160 pixels and auto-calculated height! Target size: 160x(auto) New size: 160x160 Traceback (most recent call last): File "/Users/mynamehere/Documents/GitHub/Image-to-MakeCode-Arcade/main.py", line 99, in <module> output_image = input_image.resize((new_width, new_height), Image.ANTIALIAS) ^^^^^^^^^^^^^^^ AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

UnsignedArduino commented 10 months ago

Try using LANCZOS instead of ANTIALIAS.

Brohann3214 commented 10 months ago

That helped! but idk if I'm doing something wrong because I got this error: Arguments received: Namespace(input=PosixPath('catty.png'), output=PosixPath('petpalace.txt'), preview=True, width=None, height=None, palette='#000000,#ffffff,#ff2121,#ff93c4,#ff8135,#fff609,#249ca3,#78dc52,#003fad,#87f2ff,#8e2ec4,#a4839f,#5c406c,#e5cdc4,#91463d,#000000', gif=False) Opening image /Users/myname/Documents/GitHub/Image-to-MakeCode-Arcade/catty.png Size: 400x400 Width and height were not specified, defaulting to width of 160 pixels and auto-calculated height! Target size: 160x(auto) New size: 160x160 Resized image Using palette of 16 colors Traceback (most recent call last): File "/Users/myname/Documents/GitHub/Image-to-MakeCode-Arcade/main.py", line 212, in <module> output_image = change_palette(output_image, palette) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/myname/Documents/GitHub/Image-to-MakeCode-Arcade/main.py", line 142, in change_palette new_image = image.copy().convert("RGB") ^^^^^^^^^^ AttributeError: 'tuple' object has no attribute 'copy'

UnsignedArduino commented 10 months ago

Hmmm, can you try installing Pillow 9.5 instead? There seems to be more changes then I expected...

Brohann3214 commented 10 months ago

I'm still getting that error even with Pillow 9.5

Brohann3214 commented 10 months ago

never mind! i figured it out!

UnsignedArduino commented 10 months ago

This issue will be a reminder to update dependencies