mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-01-18 07:17:03 +00:00
Add files via upload
Image Resizer Using Python
This commit is contained in:
parent
e92ca28198
commit
9458fceb81
7
scripts/image_resize/readme.md
Normal file
7
scripts/image_resize/readme.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
Image Resizer Using Python
|
||||
So, I was working on this one project where I needed to place equal size images. To make it look good.
|
||||
|
||||
But doing one picture at a time is such a waste. So, I created this simple script to make this easy for me.
|
||||
Dependencies
|
||||
|
||||
Only dependecy is OpenCV2
|
BIN
scripts/image_resize/resize image.png
Normal file
BIN
scripts/image_resize/resize image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 436 KiB |
25
scripts/image_resize/resize_image.py
Normal file
25
scripts/image_resize/resize_image.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
import cv2
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
image = cv2.imread("D:\image.jpg", 1)
|
||||
# Loading the image
|
||||
|
||||
half = cv2.resize(image, (0, 0), fx=0.1, fy=0.1)
|
||||
bigger = cv2.resize(image, (1050, 1610))
|
||||
|
||||
stretch_near = cv2.resize(image, (780, 540),
|
||||
interpolation=cv2.INTER_NEAREST)
|
||||
|
||||
|
||||
Titles = ["Original", "Half", "Bigger", "Interpolation Nearest"]
|
||||
images = [image, half, bigger, stretch_near]
|
||||
count = 4
|
||||
|
||||
for i in range(count):
|
||||
plt.subplot(2, 2, i + 1)
|
||||
plt.title(Titles[i])
|
||||
plt.imshow(images[i])
|
||||
|
||||
plt.show()
|
1
scripts/image_resize/tempCodeRunnerFile.py
Normal file
1
scripts/image_resize/tempCodeRunnerFile.py
Normal file
|
@ -0,0 +1 @@
|
|||
matplotlib.pyplot
|
Loading…
Reference in New Issue
Block a user