SKILL.md
Language Markdown5.0 KB86 lines
---name: topaz-prepressdescription: >Analyze low-resolution or undersized raster images (logos, graphics, scans, photos) andprep them for a Topaz Gigapixel upscale, then return the prepped files in a zip plus amarkdown report recommending the optimal Topaz model and settings for each image. Use thisskill whenever the user hands over one or more images that need upscaling, enlarging,"cleaning up for print," "prepping for Topaz," "making bigger," or fixing low resolutionfor banners, signage, or large-format output, even if they don't say "Topaz" by name. Alsotrigger on phrases like "this logo is too small," "client sent a tiny file," "get thisready to upscale," "prep these for Gigapixel," "what Topaz settings for this," or any batchof logos/artwork dropped in with the goal of enlarging them. Handles PNG, JPEG, WebP, BMP,and TIFF, including transparent logos (splits and defringes the alpha so edges don't halo).---# Topaz Pre-PassTakes raster images that are headed for a Topaz Gigapixel upscale and does two jobs: it**preps** each file so Topaz starts from a clean signal, and it **recommends** the rightTopaz model and settings per image. Output is a zip of prepped files plus a markdown report.## The core principle (do not violate it)Topaz works best on the **original signal**. Do not pre-sharpen, pre-denoise, or "enhance"in Python before Topaz, that destroys the detail Topaz reconstructs from and double-stackswith Topaz's own denoise/sharpen. Python's only legitimate pre-pass jobs are **structure andformat hygiene** and **routing**:- Normalize color mode (indexed/palette, grayscale, CMYK, JPEG) to a clean RGB/RGBA working file.- Re-save lossless PNG so no further generational loss happens (critical for JPEG sources).- For transparent logos: split the alpha into a separate mask and **defringe** the RGB(extend edge color into transparent areas) so the upscale doesn't pull a halo into the edges.- Optionally pre-downscale a *false-resolution* image (inflated size, no real detail) so Topazupscales from concentrated pixels. This is opt-in, never automatic, because misjudging itthrows away real detail.If you find yourself wanting to sharpen or denoise the pixels, stop. That is Topaz's job.## Workflow1. **Locate the inputs.** Images the user uploaded live in `/mnt/user-data/uploads`. You canpass that directory directly, or individual file paths.2. **Install deps if needed:** `pip install pillow numpy scipy --break-system-packages -q`(scipy is only used for the alpha defringe; the script degrades gracefully without it).3. **Run the engine:**```bashpython scripts/prep.py /mnt/user-data/uploads --out /mnt/user-data/outputs/topaz-prep```Add `--predownscale` only if the user wants false-resolution images downscaled beforeupscaling (the report flags which images qualify). Use `--zip-name NAME.zip` to renamethe archive.4. **The script writes**, into the `--out` directory:- `*__RGB.png`: the file(s) to load into Topaz.- `*__ALPHA.png`: the transparency mask, only for images that had real transparency.- `Topaz-Prep-Report.md`: the per-image model + settings report.- `analysis.json`: machine-readable metrics and recommendations.- the zip (prepped images + report).5. **Deliver:** call `present_files` on the **zip** and the **report**. Present the report asthe markdown artifact the user reads; the zip is what they download. Keep your chat summaryshort, the report carries the detail. Flag any image where you'd override the script'sautomatic call (e.g. you can see it's an emblem, so Art & CG beats the defaulted Text &Shapes). The script routes from measurable features and is right most of the time, but youreyes on the actual image are the tiebreaker, say so when you disagree with it.## How routing worksThe script classifies each image from features it measures (color count and flatness, edgedensity, high-frequency energy vs pixel size, JPEG blockiness, alpha coverage) into one of:flat vector logo, gradient/rendered logo, detailed illustration, low-res/degraded, or a JPEGvariant. Each maps to a primary Topaz model, an alternate, and a settings block. The fullrouting table, with the reasoning and the override cases, is in`references/model-selection.md`. Read it when a recommendation looks off or the user asks why.## Recompositing transparent logosWhen the script splits a logo into `__RGB` and `__ALPHA`, the user upscales **both** by the**same** factor in Topaz (RGB with its recommended model, ALPHA with Standard and denoise off),then loads the upscaled alpha as a layer mask on the upscaled RGB in Photoshop. The reportspells this out per image. This is what keeps a transparent logo's edges clean at banner sizeinstead of fringed.## ScopeThis skill preps and recommends; it does not run Topaz (Topaz is a desktop GUI app). It willnot invent detail or fake an upscale in Python. If asked to actually upscale, explain that theupscale happens in Topaz with the prepped files and supplied settings.