diff --git a/Competitive_Solutions/CP_README.md b/Competitive_Solutions/CP_README.md new file mode 100644 index 0000000..e69de29 diff --git a/Programs/Reduce_image_file_size(VIPverma01)/README.md b/Programs/Reduce_image_file_size(VIPverma01)/README.md new file mode 100644 index 0000000..b82f38a --- /dev/null +++ b/Programs/Reduce_image_file_size(VIPverma01)/README.md @@ -0,0 +1,15 @@ +# Script Title +#### Script to reduce the size of image file using the openCV library of python. + +### Prerequisites +openCV library + +`pip install opencv-python` + +### How to run the script +- Add the image in jpg format with name as 'input.jpg' in this folder. +- Run reduce_image_size.py script. +- resized output image will be generated in this folder. + +## *Author Name* +### *Vipul Verma* diff --git a/Programs/Reduce_image_file_size(VIPverma01)/input.jpg b/Programs/Reduce_image_file_size(VIPverma01)/input.jpg new file mode 100644 index 0000000..a477b3c Binary files /dev/null and b/Programs/Reduce_image_file_size(VIPverma01)/input.jpg differ diff --git a/Programs/Reduce_image_file_size(VIPverma01)/reduce_image_size.py b/Programs/Reduce_image_file_size(VIPverma01)/reduce_image_size.py new file mode 100644 index 0000000..668595a --- /dev/null +++ b/Programs/Reduce_image_file_size(VIPverma01)/reduce_image_size.py @@ -0,0 +1,23 @@ +# import openCV library for image handling +import cv2 + +# read image to be resized by imread() function of openCV library +img = cv2.imread('input.jpg') +print(img.shape) + +# set the ratio of resized image +k = 5 +width = int((img.shape[1])/k) +height = int((img.shape[0])/k) + +# resize the image by resize() function of openCV library +scaled = cv2.resize(img, (width, height), interpolation=cv2.INTER_AREA) +print(scaled.shape) + +# show the resized image using imshow() function of openCV library +cv2.imshow("Output", scaled) +cv2.waitKey(500) +cv2.destroyAllWindows() + +# get the resized image output by imwrite() function of openCV library +cv2.imwrite('resized_output_image.jpg', scaled) diff --git a/Programs/Reduce_image_file_size(VIPverma01)/resized_output_image.jpg b/Programs/Reduce_image_file_size(VIPverma01)/resized_output_image.jpg new file mode 100644 index 0000000..9029090 Binary files /dev/null and b/Programs/Reduce_image_file_size(VIPverma01)/resized_output_image.jpg differ