Spaces:
Runtime error
Runtime error
File size: 601 Bytes
a63752b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import os
import argparse
import cv2
import matplotlib.pyplot as plt
import numpy as np
import subprocess
import sys
import time
from PIL import Image
def crop():
img = Image.open("image.jpg") #process the image
if img.height > 300 or img.width > 300: #get the height and width of the image
output_size = (900, 900) #crop the image to the output size
img.thumbnail(output_size)
ext = ['.jpeg', '.png', '.jpg'] #create list of extensions to save as
for extension in ext: #loop over the list
img.save(f"image_resize{extension}")
crop()
|