Takazudo Modular Docs

Type to search...

to open search from anywhere

l-orange-tweak

Normalize orange background color across product photos using the orange-calibrator CLI. Use when: (1) User says '/l-orange-tweak' or 'orange tweak', (2) User wants to adjust orange levels on product ...

Orange Tweak

Normalize the orange fabric background across product photos so all images have a consistent tone.

Tool Location

CLI: sub-packages/orange-calibrator/bin/orange-calibrator.mjs

Two-Step Workflow

Step 1: Calibrate (one-time or when target changes)

Pick 1-5 reference images that have the desired orange tone. Run:

cd /Users/takazudo/repos/zp/zmod/sub-packages/orange-calibrator
node bin/orange-calibrator.mjs calibrate <image1> [image2] ... [image5]

This samples the orange background from each image’s corners, averages them, and saves the target to orange-calibrator.config.json.

If already calibrated and the config file exists, skip this step unless the user wants to recalibrate.

Step 2: Process

node bin/orange-calibrator.mjs process <path>
  • If <path> is a directory: processes all image files (.heic, .jpg, .jpeg, .png, .webp, .tiff)
  • If <path> is a file: processes just that file
  • Images are overwritten in-place

Argument Handling

  • If the user provides calibrate + image paths: run calibrate
  • If the user provides a path (file or dir) without calibrate: run process
  • If no config exists and user runs process: prompt to calibrate first
  • If no arguments at all: ask the user what they want to do

After Processing

Show before/after comparison by converting 2-3 images to small JPGs (via sips -s format jpeg -Z 600) and displaying them with the Read tool so the user can visually confirm the correction.

Notes

  • HEIC files are handled via macOS sips round-trip (HEIC -> JPEG -> sharp -> JPEG -> HEIC)
  • Scale factors are clamped to 0.5-2.0 to prevent extreme corrections
  • Images smaller than 60x60 are rejected