J3ZZ

Artwork Image Processing Script

Overview

The process-artworks.sh script generates optimized images for the artwork gallery from high-resolution source images.

Source files: docs/HIGHRES-IMAGES/1200p_{B1-B8,W1-W8}.{jpg,png} Output files: assets/artworks/{slug}/{thumbnail.png,print.png}

Usage

# Preview the mapping and operations (no files created)
./scripts/process-artworks.sh --dry-run

# Process all artwork images
./scripts/process-artworks.sh

# Reprocess existing outputs (overwrite)
./scripts/process-artworks.sh --force

Output Specifications

print.png (Detail Page)

Artwork Mapping

All 16 artworks are mapped in the script:

IGNEOUS Series (B1-B8):

EROSION Series (W1-W8):

System Requirements

ImageMagick Configuration

⚠️ Important: ImageMagick has hardcoded resource limits in its policy file that cannot be overridden via command-line flags. Large images may fail with “cache resources exhausted” error.

Check Current Limits

convert -list resource

Look for:

Fix Resource Limits

If you get “cache resources exhausted” errors, increase the limits in the ImageMagick policy file:

sudo nano /etc/ImageMagick-6/policy.xml

Find these lines and update them:

<policy domain="resource" name="memory" value="4GiB"/>
<policy domain="resource" name="map" value="4GiB"/>
<policy domain="resource" name="disk" value="4GiB"/>
<policy domain="resource" name="area" value="4GP"/>

Or use sed to update automatically:

sudo sed -i 's/name="memory" value="[^"]*"/name="memory" value="4GiB"/' /etc/ImageMagick-6/policy.xml
sudo sed -i 's/name="map" value="[^"]*"/name="map" value="4GiB"/' /etc/ImageMagick-6/policy.xml
sudo sed -i 's/name="disk" value="[^"]*"/name="disk" value="4GiB"/' /etc/ImageMagick-6/policy.xml
sudo sed -i 's/name="area" value="[^"]*"/name="area" value="4GP"/' /etc/ImageMagick-6/policy.xml

Then try the script again:

./scripts/process-artworks.sh

Verification

After processing:

# Check that all thumbnails exist and are 800x800
identify -format "%f: %wx%h\n" assets/artworks/*/thumbnail.png

# Check that all print images exist and are correctly sized
identify -format "%f: %wx%h\n" assets/artworks/*/print.png

# Verify in browser
bundle exec jekyll serve
# Visit http://localhost:4000/gallery/ to see the gallery grid

Script Options

Exit codes:

Files

Notes

Adding a New Artwork Series

To extend the script for new artwork series, follow these steps:

Step 1: Prepare Source Images

Requirements:

Naming Convention: Place source files in docs/HIGHRES-IMAGES/ with the pattern: 1200p_{KEY}.(jpg|png)

Examples:

Keys are typically 2-character identifiers (letter + number, e.g., B1-B8, W1-W8 for an 8-work series).

Step 2: Add Mapping Entry

Edit scripts/process-artworks.sh and add your key → slug mapping to the MAPPING table (lines 63-80):

declare -A MAPPING=(
    # Existing entries...
    [B1]="2026-03-01-fractured-system"

    # Add your new entries:
    [Z1]="2026-04-01-new-work-title"
    [Z2]="2026-04-02-another-work-title"
    # ... more new entries
)

Slug naming convention:

Step 3: Create Markdown Files

Create _artworks/YYYY-MM-DD-{slug}.md files for each artwork with:

Required Front Matter:

Recommended Fields:

Sections: Use the split-hero-metadata module to display the high-res print image:

sections:
  - type: description  # Displays the description field

  - type: split-hero-metadata
    content_type: "image"
    image: /assets/artworks/YYYY-MM-DD-slug/print.png  # References generated print image
    caption: "Optional caption"
    custom:
      - label: "Series"
        value: "Series Name"
      - label: "Medium"
        value: "Ink on paper"
      - label: "Dimensions"
        value: "29.7 × 42 × 0.1 cm"
      - label: "Year"
        value: "2026"
      - label: "Status"
        value: "Available"

See _artworks/2026-03-01-fractured-system.md for a complete example.

Step 4: Create Output Directories

Create assets/artworks/{slug}/ directories (one per artwork). These will hold the generated thumbnail.png and print.png files:

mkdir -p assets/artworks/2026-04-01-new-work-title
mkdir -p assets/artworks/2026-04-02-another-work-title

Step 5: Run the Script

Process all artworks in the updated mapping:

# Preview without creating files
./scripts/process-artworks.sh --dry-run

# Process all artworks
./scripts/process-artworks.sh

# Reprocess and overwrite existing images
./scripts/process-artworks.sh --force

The script will:

  1. Read source images from the mapping
  2. Generate 800×800 thumbnails with white letterbox padding
  3. Generate print images (max 1800px, aspect ratio preserved)
  4. Place outputs in assets/artworks/{slug}/

Step 6: Verify Results

Check that all images were generated with correct dimensions:

# List all thumbnails with dimensions
identify -format "%f: %wx%h\n" assets/artworks/*/thumbnail.png

# List all print images with dimensions
identify -format "%f: %wx%h\n" assets/artworks/*/print.png

# Expected results:
# thumbnail.png: 800x800
# print.png: depends on source aspect ratio, max 1800px longest side

Troubleshooting

“cache resources exhausted” error: ImageMagick has hardcoded resource limits in its policy file. If processing fails, increase the limits:

sudo nano /etc/ImageMagick-6/policy.xml

Update these values to 4GB (or higher if available):

<policy domain="resource" name="memory" value="4GiB"/>
<policy domain="resource" name="map" value="4GiB"/>
<policy domain="resource" name="disk" value="4GiB"/>
<policy domain="resource" name="area" value="4GP"/>

Or use the automatic sed commands in the script’s comments (lines 102-109).

Reusing the Workflow

This same workflow can be used for:

Just add mapping entries, create markdown files, prepare source images, and run the script.