# Gallery: Scientific Plot Organizer
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
**Create responsive HTML galleries for scientific plot collections. Convert PDFs to PNG, organize plots hierarchically, and generate beautiful static websites.**
## Features
### Core Functionality
- **PDF to PNG Conversion**: Automatic high-quality thumbnail generation using ImageMagick
- **Incremental Updates**: Only processes files when source is newer than target
- **Responsive Design**: Mobile-friendly interface with multiple view modes
- **Hierarchical Organization**: Support for nested folder structures
- **Search & Navigation**: Real-time search with fuzzy matching
### Advanced Features
- **Plot Comparison**: Side-by-side comparison tool for analyzing differences
- **Metadata Management**: YAML/JSON metadata with inheritance and display, to properly label each folder
- **Recent Plots**: Quick access to recently viewed items
- **Theme Support**: Dark/light theme toggle
- **Keyboard Shortcuts**: Power-user navigation
### Developer-Friendly
- **Python API**: Import and use programmatically in other projects
- **CLI Interface**: Command-line command `gallery`
- **TUI Interface**: Textual-based terminal UI `gallery tui`
- **Configuration Flexibility**: Config file stored under user `$HOME/.config/gallery`
- **Source Override**: Process single directories without full regeneration
## 📸 Screenshots
### Main Gallery View

### Metadata Display

### Plot Comparison Tool

### Search Functionality
## ⚙️ Configuration
### config.yaml Structure
```yaml
# Gallery configuration
web_folder: "/web/user/public_html"
plot_root: "gallery"
png_dpi: 150 # just the thumbnails
# Source directories
sources:
- name: "analysis_results"
path: "/path/to/plots/directory"
- name: "specific_plot"
path: "/path/to/single/plot.pdf"
# UI settings
ui:
search_debounce_ms: 300
max_recent_plots: 20
# Path settings
paths:
work_dir: "/work/directory"
```
### Metadata Files
Create `metadata.yaml` files in your source directories. The fields are all arbitrary and rendered using
yaml object interpretation (dict, list...). You can have different metadata.yaml files in each folder,
with lower-level fields overriding the parent values. Great for labelling specific experiments.
```yaml
# metadata.yaml
title: "Analysis Results"
description: "Results for my analysis"
experiment: "CMS"
dataset: "Run2_2016_nano_v9"
parameters:
luminosity: "35.9 fb^{-1}"
center_of_mass_energy: "13 TeV"
selection: "baseline"
tags:
- "physics"
- "analysis"
- "cms"
authors:
- "Researcher A"
- "Researcher B"
```
## 🎮 User Interface Guide
### Navigation Controls
| Button | Function | Keyboard Shortcut |
|--------|----------|-------------------|
| 🔍 Search | Real-time plot search | `Ctrl+K` |
| 📋 Recent | Recently viewed plots | `Ctrl+R` |
| ⚖️ Compare | Side-by-side comparison | `Ctrl+C` |
| ☀️ Theme | Toggle dark/light theme | `Ctrl+T` |
### Metadata Section

- **Toggle Button**: Show/hide folder information
- **Copy Path**: Quick access to metadata file location
- **Hover Tip**: Information about metadata file formats
- **YAML Structure**: Preserves original formatting and indentation
### View Modes
- **Grid View**: Thumbnail grid with metadata overlay
- **Large List**: Detailed list with larger previews
- **Compact List**: Dense list for quick scanning
## 🛠️ Development Guide
### Project Structure
```
scientific-gallery-generator/
├── generate_gallery.py # Main gallery generator
├── config.yaml # Configuration file
├── templates/
│ └── gallery.html # Jinja2 template
├── assets/
│ ├── css/ # Stylesheets
│ │ ├── main.css # Main stylesheet
│ │ ├── variables.css # CSS variables
│ │ ├── metadata-section.css # Metadata styling
│ │ └── ...
│ └── js/ # JavaScript modules
│ ├── main.js # Application entry point
│ ├── gallery-app.js # Core application
│ ├── metadata-section.js # Metadata functionality
│ └── ...
├── orchestration/
│ ├── config.py # Configuration management
│ ├── metadata.py # Metadata handling
│ └── ...
└── tests/
└── validate_metadata.py # Metadata validation
```
### Adding New Features
#### 1. CSS Components
```css
/* assets/css/new-feature.css */
.new-feature {
/* Your styles here */
}
```
Add to `assets/css/main.css`:
```css
@import url('./new-feature.css');
```
#### 2. JavaScript Modules
```javascript
// assets/js/new-feature.js
export class NewFeature {
constructor() {
this.init();
}
init() {
// Initialize your feature
}
}
```
Import in `assets/js/gallery-app.js`:
```javascript
import { NewFeature } from './new-feature.js';
```
#### 3. Template Extensions
```html
{% if new_feature_enabled %}