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

Code should be able to handle images of any size, not hardcoded to 512 x 512 #2

Open
MattFerraro opened this issue Aug 18, 2021 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@MattFerraro
Copy link
Owner

The code should obviously handle images of any size, not just the hardcoded assumption of 512 x 512. There is no reason the code cannot be made to do that, I just haven't gotten around to it.

@ManoharOfficial
Copy link

\would this work?
import argparse
import os
from PIL import Image

def main(file_path):
# Check if file exists
if not os.path.isfile(file_path):
raise FileNotFoundError("Invalid file path")
# Check if file is image
try:
Image.open(file_path)
except:
raise ValueError("Invalid image")
# Replace all instances of the hardcoded image with the user-specified image
image = Image.open(file_path)
# Rest of the code

if name == "main":
parser = argparse.ArgumentParser()
parser.add_argument("file_path", help="Path to image file")
args = parser.parse_args()
main(args.file_path)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants