Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display Last 10 Images in Image History for Sugar cube #160

Open
pulkit21 opened this issue Jan 22, 2024 · 1 comment
Open

Display Last 10 Images in Image History for Sugar cube #160

pulkit21 opened this issue Jan 22, 2024 · 1 comment
Labels
good first issue Good for newcomers

Comments

@pulkit21
Copy link
Contributor

No description provided.

@pulkit21 pulkit21 added the good first issue Good for newcomers label Jan 23, 2024
@AquarlisPrime
Copy link

AquarlisPrime commented Feb 6, 2024

Umm, assuming there's a timestamp in the image filenames for sorting, we can work on it as follows:.

import os
from PIL import Image
import matplotlib.pyplot as plt

dataset_path = 'ds_path'
image_files = sorted(os.listdir(ds_path), key=os.path.getmtime, reverse=True)[:10]

fig, axes = plt.subplots(2, 5, figsize=(12, 6))
fig.suptitle("Last 10 Images for Sugar Cube")

for i, image_file in enumerate(image_files):
image_path = os.path.join(ds_path, image_file)
image = Image.open(image_path)

axes[i // 5, i % 5].imshow(image)
axes[i // 5, i % 5].axis('off')
axes[i // 5, i % 5].set_title(f"Image {i + 1}")

plt.show()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants