You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
\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)
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.
The text was updated successfully, but these errors were encountered: