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

Unable to use height and width arguments #31

Closed
MikkyD23 opened this issue Jan 14, 2022 · 1 comment
Closed

Unable to use height and width arguments #31

MikkyD23 opened this issue Jan 14, 2022 · 1 comment

Comments

@MikkyD23
Copy link

Description

Whenever I try to convert an image while giving height and width arguments I get a valueError from the factor being set. However, I only supplied the input, output, height, and width.

PS C:\...\pyxelate\pyxelate> python main.py "testIcon.jpg" "output.png" --height 32 --width 32
Pyxelating testIcon.jpg...
Traceback (most recent call last):
  File "main.py", line 202, in <module>
    main()
  File "main.py", line 195, in main
    convert(args)
  File "main.py", line 37, in convert
    pyx = get_model(args)
  File "main.py", line 23, in get_model
    return Pyx(
  File "C:\...\pyxelate\pyxelate\pyx.py", line 121, in __init__
    raise ValueError("You can only set either height + width or the downscaling factor, but not both!")
ValueError: You can only set either height + width or the downscaling factor, but not both!

pyxelate/pyxelate/pyx.py

Lines 120 to 121 in fbbcfbc

if (width is not None or height is not None) and factor is not None:
raise ValueError("You can only set either height + width or the downscaling factor, but not both!")

Seems like the argument parsing is defaulting the factor to 1

parser.add_argument("--factor", type=int, help="Downsample factor.", default=1)

Setting the default to None makes the command work as intended (outputs a 32x32 image)

@sedthh
Copy link
Owner

sedthh commented Jan 15, 2022

Thanks for the bug report, I've updated the CLI tool!

@sedthh sedthh closed this as completed Jan 15, 2022
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