Skip to content

Commit ed51202

Browse files
Update sli-guardian.ps1
Standardize documentation and formatting
1 parent 25eb252 commit ed51202

File tree

1 file changed

+84
-16
lines changed

1 file changed

+84
-16
lines changed

utilities/sli-guardian.ps1

Lines changed: 84 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,88 @@
1+
#!/usr/bin/env pwsh
2+
# This script is designed to be run in a PowerShell environment.
3+
14
# Name: SLI Guardian
2-
# Version: 5.0
3-
# Description: This script applies an overlay to images, designed for use with pedestrian-perspective street-level imagery from a GoPro Max
5+
# Version: 6.0.0
6+
# Date: 2025-09-23
47
# Author: Amy Bordenave, Taskar Center for Accessible Technology, University of Washington
5-
# Date: 2025-09-03
68
# License: CC-BY-ND 4.0 International
7-
#
8-
# This script is designed to be run in a PowerShell environment.
9-
# Prerequisites: ImageMagick and ExifTool must be installed and in PATH
10-
#
11-
# Usage:
12-
# .\sli-guardian.ps1 -inputDir <input_directory> -outputDir <output_directory> -overlay <overlay_file> -maxParallel <n> -batchSize <n> -jpegQuality <n>
13-
#
14-
# Examples:
15-
# .\sli-guardian.ps1
16-
# .\sli-guardian.ps1 -inputDir ".\input" -outputDir ".\output" -overlay ".\overlay.png" -maxParallel 8 -batchSize 50 -jpegQuality 90
17-
# .\sli-guardian.ps1 -inputDir "C:\TCAT GoPro\ingest\2025-07-25\101\1" -outputDir "C:\TCAT GoPro\export\2025-07-25\101\1" -overlay "C:\TCAT GoPro\overlay\tcat-purple.png" -jpegQuality 85
9+
10+
<#
11+
.SYNOPSIS
12+
Applies overlay images to street-level imagery
13+
14+
.DESCRIPTION
15+
This script applies an overlay to images, designed for use with pedestrian-perspective
16+
street-level imagery from devices like GoPro Max cameras. It processes images in
17+
parallel batches for optimal performance, copying input images to an output directory,
18+
applying the specified overlay, and preserving EXIF metadata from the original files.
19+
20+
The script supports various image formats and includes validation for overlay
21+
compatibility, progress reporting, and comprehensive error handling.
22+
23+
.PARAMETER InputDir
24+
Path to the directory containing input images to process
25+
26+
.PARAMETER OutputDir
27+
Path to the directory where processed images will be saved
28+
29+
.PARAMETER Overlay
30+
Path to the PNG overlay file to apply to all images
31+
32+
.PARAMETER MaxParallel
33+
Maximum number of parallel processing jobs
34+
35+
.PARAMETER BatchSize
36+
Number of images to process in each batch
37+
Default: 50
38+
39+
.PARAMETER JpegQuality
40+
JPEG compression quality (1-100) for JPEG output files
41+
Default: 70
42+
43+
.PARAMETER SkipExif
44+
Skip copying EXIF metadata from original files
45+
46+
.EXAMPLE
47+
.\sli-guardian.ps1 -inputDir ".\input" -outputDir ".\output" -overlay ".\overlay.png"
48+
49+
Processes images from .\input directory using default settings
50+
51+
.EXAMPLE
52+
.\sli-guardian.ps1 -inputDir "C:\TCAT GoPro\ingest\2025-07-25\101\1" -outputDir "C:\TCAT GoPro\export\2025-07-25\101\1" -overlay "C:\TCAT GoPro\overlay\tcat-purple.png" -jpegQuality 85
53+
54+
Processes images with custom parallel processing and quality settings
55+
56+
.NOTES
57+
Prerequisites:
58+
- ImageMagick must be installed and available in PATH
59+
- ExifTool must be installed and available in PATH (unless -skipExif is used)
60+
61+
Supported image formats:
62+
- Input: .jpg, .jpeg, .png, .gif, .bmp, .tiff, .tif
63+
- Overlay: .png only
64+
65+
The script performs these operations:
66+
1. Validates all inputs and prerequisites
67+
2. Copies input images to output directory
68+
3. Validates overlay dimensions match image dimensions
69+
4. Applies overlay to images in parallel batches
70+
5. Preserves EXIF metadata from original files (unless -skipExif)
71+
6. Provides detailed progress reporting and error handling
72+
73+
JPEG handling:
74+
- JPEG files are processed with quality settings
75+
- Extensions are normalized to lowercase .jpg
76+
- Non-JPEG files are processed without quality settings
77+
78+
Exit codes:
79+
- 0: All images processed successfully
80+
- 1: No images processed (validation errors or no input images)
81+
- 2: Some images failed processing (partial success)
82+
83+
.LINK
84+
https://github.com/TaskarCenterAtUW/tdei-tools
85+
#>
1886

1987
param(
2088
[Parameter(Mandatory = $true)]
@@ -34,7 +102,7 @@ param(
34102

35103
[Parameter(Mandatory = $false)]
36104
[ValidateRange(1, 100)]
37-
[int]$jpegQuality = 70,
105+
[int]$jpegQuality = 90,
38106

39107
[Parameter(Mandatory = $false)]
40108
[switch]$skipExif
@@ -44,7 +112,7 @@ param(
44112
$script:ImageExtensions = @('.jpg', '.jpeg', '.png', '.gif', '.bmp', '.tiff', '.tif')
45113
$script:JpegExtensions = @('.jpg', '.jpeg')
46114

47-
Write-Host "SLI Guardian v5.0" -ForegroundColor Cyan
115+
Write-Host "SLI Guardian v6.0.0" -ForegroundColor Cyan
48116
Write-Host "Max Parallel Jobs: $maxParallel | Batch Size: $batchSize | JPEG Quality: $jpegQuality" -ForegroundColor Cyan
49117

50118
# Step 1: Validation

0 commit comments

Comments
 (0)