Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions README_CONVERTER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Converter

Extracts and converts 12-bit `.8ij` image files to 8-bit JPEG.

## Setup

Requires Python 3.11+ and [Poetry](https://python-poetry.org/).

```bash
# Install dependencies
poetry install
```

## Usage

```bash
poetry run converter <input_dir> <output_dir>
```

- `input_dir` — directory containing `.8ij` files (searched recursively)
- `output_dir` — directory where extracted JPEG files will be written

### Options

| Flag | Description |
|------|-------------|
| `-q`, `--quiet` | Suppress verbose output |

### Example

```bash
poetry run converter ./Plates/S05P/T02/8ij/R01/Cam0/ ./extracted_jpegs
```

This will find all `.8ij` files under `./Plates/S05P/T02/8ij/R01/Cam0/`, extract each frame, convert from 12-bit to 8-bit with gamma correction, and save as JPEG (quality 95) in `./extracted_jpegs`, preserving the directory structure.
29 changes: 29 additions & 0 deletions converter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python3
"""CLI tool to extract and convert 12-bit .8ij files to 8-bit JPEG."""

import argparse
import sys
from pathlib import Path

from floorfinder.converter import process_directory


def main():
parser = argparse.ArgumentParser(
description="Extract and convert 12-bit .8ij files to 8-bit JPEG"
)
parser.add_argument("input_dir", type=Path, help="Directory containing .8ij files")
parser.add_argument("output_dir", type=Path, help="Output directory for JPEG files")
parser.add_argument("-q", "--quiet", action="store_true", help="Suppress verbose output")

args = parser.parse_args()

if not args.input_dir.exists():
print(f"Error: Input directory not found: {args.input_dir}", file=sys.stderr)
sys.exit(1)

process_directory(args.input_dir, args.output_dir, verbose=not args.quiet)


if __name__ == "__main__":
main()
Loading