Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image resize issue #52

Open
angelsix opened this issue Oct 19, 2023 · 4 comments
Open

Image resize issue #52

angelsix opened this issue Oct 19, 2023 · 4 comments

Comments

@angelsix
Copy link

parse_roms.py needs

Import PIL

Adding, and Image.ANTIALIAS changing to PIL.Image.LANCZOS .

Reason: Image.ANTIALIAS is now deprecated

@Vendo232
Copy link

I`m getting this error

  File "/home/server/development/gamewatch/game-and-watch-retro-go/parse_roms.py", line 1087, in generate_system
    f.write(self.generate_img_object_file(rom, cover_width, cover_height))
  File "/home/server/development/gamewatch/game-and-watch-retro-go/parse_roms.py", line 668, in generate_img_object_file
    write_covart(Path(img), rom.img_path, w, h, args.jpg_quality)
  File "/home/server/development/gamewatch/game-and-watch-retro-go/parse_roms.py", line 237, in write_covart
    img = Image.open(srcfile).convert(mode="RGB").resize((w, h), Image.ANTIALIAS)
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
make[1]: *** [Makefile.common:581: build/roms.a] Error 1
make[1]: Leaving directory '/home/server/development/gamewatch/game-and-watch-retro-go'
make: *** [Makefile.common:800: flash] Error 2

How do I fix it?

@angelsix
Copy link
Author

Exactly as I mentioend above, do that change to the py script

@Vendo232
Copy link

Vendo232 commented Nov 27, 2023

thank you Sir. I did change per your instructions

from

    from PIL import Image, ImageOps
    img = Image.open(srcfile).convert(mode="RGB").resize((w, h), Image.ANTIALIAS)
    img.save(fn,format="JPEG",optimize=True,quality=jpg_quality)```

to

```def write_covart(srcfile, fn, w, h, jpg_quality):
    from PIL import Image, ImageOps
    img = Image.open(srcfile).convert(mode="RGB").resize((w, h), PIL.Image.LANCZOS)
    img.save(fn,format="JPEG",optimize=True,quality=jpg_quality)```

still getting error
pictures I`m trying are PNG not JPEG, but they worked in the past

@angelsix
Copy link
Author

You have to do this after fetching the repo. If you re-run the code that fetches the repo again it will override your changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants