-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscratch_1.py
More file actions
29 lines (26 loc) · 989 Bytes
/
Copy pathscratch_1.py
File metadata and controls
29 lines (26 loc) · 989 Bytes
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
27
28
29
import os
from PIL import Image
import pandas as pd
import matplotlib.pyplot as plt
def get_image_dimensions(image_folder):
data = []
for filename in os.listdir(image_folder):
if filename.lower().endswith(('.png', '.jpg', '.jpeg', '.tiff', '.bmp', '.gif')):
path = os.path.join(image_folder, filename)
with Image.open(path) as img:
width, height = img.size
data.append({'Filename': filename, 'Width': width, 'Height': height})
return pd.DataFrame(data)
def plot_dimensions(data_frame):
plt.figure(figsize=(10, 6))
for _, row in data_frame.iterrows():
plt.plot(row['Width'], row['Height'], 'o')
plt.xlabel('Width')
plt.ylabel('Height')
plt.title('Image Dimensions')
plt.legend()
plt.show()
# Replace 'your_folder_path' with the path to the folder containing the images
image_folder = r'C:\Users\ADMIN\Desktop\shota'
df = get_image_dimensions(image_folder)
plot_dimensions(df)