Agent skill

waifu2x

Use when the user wants to upscale one image or a folder of images with waifu2x-ncnn-vulkan, including default or custom scale, noise reduction, model, format, tile size, and batch processing.

Stars 0
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/eryet/codex-skill-collection/tree/main/skills/waifu2x

SKILL.md

Waifu2x

Use this skill when the user wants local image upscaling with waifu2x-ncnn-vulkan.

Keep the workflow practical:

  1. Resolve the input path.
  2. Choose defaults or gather custom options.
  3. Find the waifu2x executable.
  4. Run the upscaling command.
  5. Report output paths, sizes, and any failures.

Input resolution

Determine the input path in this order:

  1. A path explicitly supplied with the skill invocation or user message.
  2. A path inferred from attached or pasted image metadata when available.
  3. Ask the user for the file or folder path only if no reliable path is available.

Then determine whether the path is a file or a directory.

  • If it is a file, verify it exists and process that single image.
  • If it is a directory, enumerate only the top-level files matching: *.png, *.jpg, *.jpeg, *.webp, *.bmp, *.tga
  • In folder mode, skip files whose names already contain _waifu2x_.
  • If no matching files are found, tell the user and stop.

Defaults and customization

If the user asks for a quick run, default run, or uses -d / --default, do not ask follow-up questions. Use:

  • scale: 2
  • noise: 2
  • model: models-cunet
  • format: png
  • tile: 0

Otherwise, prefer asking a single concise question only when the user has not already provided enough detail. Supported options:

  • scale: 1, 2, 4
  • noise: -1, 0, 1, 2, 3
  • model:
    • models-cunet
    • models-upconv_7_anime_style_art_rgb
    • models-upconv_7_photo
  • format: png, jpg, webp
  • tile: 0, 32, 64, 128, 256, 400

If the user says "use defaults", apply the default values above immediately.

Finding the executable

Prefer this order:

  1. Check the Codex memory file reference_waifu2x_path.md under the user's Codex memories directory. If $CODEX_HOME is available, prefer $CODEX_HOME/memories/reference_waifu2x_path.md.
  2. Try resolving waifu2x-ncnn-vulkan from PATH.
  3. Search common local locations only if needed.
  4. Ask the user for the full path to waifu2x-ncnn-vulkan.exe if it still cannot be found.

Whenever the user provides a valid executable path, update that memory file so future runs can reuse it.

When using a full executable path, compute the model directory relative to the executable's folder.

Command construction

Name each output file:

<original-name>_waifu2x_<scale>x.<format>

Place the output beside the source image.

Command shape:

powershell
<waifu2x-path> -i "<input-path>" -o "<output-path>" -s <scale> -n <noise> -m "<model-path>" -f <format> -t <tile-size>

In directory mode, process files sequentially and continue past per-file failures. Emit progress updates during long runs.

Reporting

For a single image:

  • report the final output path
  • report the output file size
  • if the command fails, include the relevant error and likely fixes

For a folder:

  • summarize each file as success or failure
  • report output file sizes for successful results
  • report total succeeded and failed
  • include concrete failures and likely fixes

Failure handling

If waifu2x fails, check and mention the most likely cause:

  • executable not found
  • invalid model path
  • unsupported input format
  • insufficient VRAM or memory

If VRAM is likely the problem, suggest retrying with a smaller tile size.

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results