Edit Image banner
disler disler

Edit Image

Development community intermediate

Description

This command edits existing images based on provided edit prompts using Replicate's API directly via curl.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

Repository README

This is the README for disler/agentic-drop-zones, shared by 6 entries in this directory. It describes the repository, not this entry specifically.


name: Edit Image allowed-tools: Bash, Read description: Edit existing images via Replicate using direct curl API calls

Edit Image

This command edits existing images based on provided edit prompts using Replicate's API directly via curl.

Prerequisites

  • REPLICATE_API_TOKEN must be exported in the environment
  • Requires base64 command for inline image encoding

Variables

DROPPED_FILE_PATH: [[FILE_PATH]] DROPPED_FILE_PATH_ARCHIVE: agentic_drop_zone/edit_images_zone/drop_zone_file_archive/ IMAGE_OUTPUT_DIR: agentic_drop_zone/edit_images_zone/image_output// - This is the directory where all images will be saved - The date_time is the current date and time in the format YYYY-MM-DD_HH-MM-SS MODEL: google/nano-banana API_ENDPOINT: https://api.replicate.com/v1/models/google/nano-banana/predictions

Workflow

  • Note: REPLICATE_API_TOKEN will be available, don't search for it and NEVER read the .env file directly.
    • IMPORTANT: If for some reason you run into issues with authentication, abort immediately - do not continue with any image processing. Mention that the REPLICATE_API_TOKEN might be missing.
  • First, read DROPPED_FILE_PATH.
  • Create output directory: IMAGE_OUTPUT_DIR//
  • IMPORTANT: For every image edit detailed in the DROPPED_FILE_PATH do the following:
- Extract the source image path and edit prompt from the dropped file - Use curl with inline base64 encoding to send image directly to Replicate API: ```bash curl -s -X POST \ -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ -H "Content-Type: application/json" \ -H "Prefer: wait" \ -d '{ "input": { "prompt": "YOUR_EDIT_PROMPT_HERE", "image_input": ["data:image/jpeg;base64,'$(base64 -i /path/to/source/image.jpg)'"], "output_format": "jpg" } }' \ https://api.replicate.com/v1/models/google/nano-banana/predictions ``` - IMPORTANT: Replace `YOUR_EDIT_PROMPT_HERE` with the actual edit instruction - IMPORTANT: Replace `/path/to/source/image.jpg` with the actual source image path which should be detailed in the `DROPPED_FILE_PATH` - IMPORTANT: The base64 encoding happens inline using `$(base64 -i /path/to/image.jpg)` - Parse JSON response to extract the `output` URL field for the generated image - Response format: `{"id":"...", "output":"https://replicate.delivery/...jpg", "status":"succeeded"}` - Extract URL with `jq -r '.output'` - Save the executed edit prompts to `IMAGE_OUTPUT_DIR//edit_prompt_.txt` - Include both the source image path and the exact edit prompt that was executed - Download the edited image from the output URL: `curl -o IMAGE_OUTPUT_DIR//_edited_.jpg "OUTPUT_URL"` - Display: - Source image path - Edit prompt used - Generation time (if available in response)