INNER CODE UNIT · Python
list_dataset_images
virajmavani/semi-auto-image-annotation-tool · web/backend/main.py:489
async def list_dataset_images():
"""List all images in the current dataset directory"""
if current_dataset_dir is None:
raise HTTPException(status_code=400, detail="No dataset directory set")
try:
image_extensions = {'.jpg', '.jpeg', '.png', '.bmp', '.gif', '.tiff'}
images = []
for file_path in sorted(current_dataset_dir.iterdir()):
if file_path.is_file() and file_path.suffix.lower() in image_extensions:
try:
with Image.open(file_path) as img:
width, height = img.size
images.append({
"filename": file_path.name,
"path": str(file_path),
"width": width,