olderzeus / game-and-watch-retro-go

Emulator collection for Nintendo® Game & Watch™
GNU General Public License v2.0
96 stars 17 forks source link

Image resize issue #52

Open angelsix opened 1 year ago

angelsix commented 1 year ago

parse_roms.py needs

Import PIL

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

Reason: Image.ANTIALIAS is now deprecated

Vendo232 commented 11 months ago

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 commented 11 months ago

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

Vendo232 commented 11 months ago

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 commented 11 months ago

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