Resize and save any photo to any size using OpenCV

import cv2
import os
directory = '/Users/sai/Desktop/everything'
file_name = "IMG_5630.JPG"
height_after_resize = 1000
width_after_resize = 1000
save_new_file_as = "thousand"
os.chdir(directory)
img = cv2.imread(directory + "/"+ file_name)
img = cv2.resize(img, (height_after_resize,width_after_resize))
cv2.imwrite(save_new_file_as +'.jpg', img)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sairam Penjarla

Sairam Penjarla

Looking for my next opportunity to make change in a BIG way