Envi Automation Skill

    by Shihao Yu

    1

    Automate ENVI/IDL remote-sensing workflows with tested, step-by-step guidance, IDL pipeline templates, and Windows GUI screenshot automation.

    Free

    Security scanned

    Works with the AI Agents you already use

    envi-automation-skill

    Example session with this skill installed

    I need an IDL script to run FXSegmentation on 'E:\data\input.hdr' and save to 'E:\data\output.dat' using the Edge algorithm with scale 50. Provide the Python runner too.

    • Read your context and instructions
    • Compiled the envi-automation-

    I have generated the IDL procedure and the Python runner. I have ensured the IDL code includes the mandatory ENVI initialization and uses CRLF line endings to prevent syntax errors.

    ENVI FXSegmentation Automation

    ; segment_task.pro
    pro segment_task
      compile_opt idl2
      
      ; Setup paths
      src = 'E:\data\input.hdr'
      seg = 'E:\data\output.dat'
      
      ; Delete existing output to prevent ENVI overwrite error
      if file_search(seg) ne '' then file_delete, seg
      
      ; Initialize ENVI 6.2/5.6 environment
      e = ENVI()
      raster = e.OpenRaster(src)
      
      ; Configure Segmentation Task
      task = ENVITask('FXSegmentation')
      task.INPUT_RASTER = raster
      task.SEGMENT_ALGORITHM = 'Edge'
      task.SEGMENT_VALUE = 50.0
      task.MERGE_ALGORITHM = 'Full Lambda Schedule'
      task.MERGE_VALUE = 60.0
      task.OUTPUT_RASTER_URI = seg
      
      task.Execute
      e.Close
    end
    
    import subprocess
    import os
    
    def run_segmentation(idl_path, script_dir):
        # Use stdin pipe as -e / -rt flags are unreliable
        p = subprocess.Popen(
            [idl_path], 
            cwd=script_dir, 
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE, 
            stderr=subprocess.STDOUT
        )
        
        # Send commands to the IDL kernel
        commands = ".compile segment_task\nsegment_task\nexit\n"
        out, _ = p.communicate(input=commands.encode())
        
        print(out.decode('gbk', errors='ignore'))
    
    # Example usage
    # run_segmentation(r'C:\Program Files\NV5\ENVI62\IDL92\bin\bin.x86_64\idl.exe', 'E:\\data')
    

    Next steps

    1. Verify that E:\data\input.hdr exists and the path contains no non-ASCII characters.
    2. Run the Python script to trigger the IDL kernel via the stdin pipeline.
    3. Check the output.dat file in the data directory after the process exits.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Managing remote sensing imagery in ENVI and IDL often leads to frustration with broken command-line arguments, blurry programmatic screenshots, and deprecated API calls. This skill provides a verified automation framework for remote sensing engineers to execute reliable batch processing and GUI-driven workflows.

    What it does

    • Headless Execution executes IDL scripts via stable stdin piping, bypassing broken CLI flags like -e or -rt.
    • Object Segmentation automates FXSegmentation for high-resolution imagery using optimized Edge and Quadtree algorithms.
    • Reliable Screenshots captures native-resolution GUI outputs using the Windows compositor (Win+Shift+S) to avoid DPI scaling blur.
    • API Version Bridging resolves common ENVITask initialization errors between ENVI 5.6 and 6.2 versions.
    • Vector Export automates the conversion of classification results into ready-to-use shapefiles.
    • Environment Management auto-detects ENVI installations and ensures correct license paths and file encoding (CRLF) for IDL.

    How it works

    1. Environment Probe detects the local ENVI/IDL installation path and verifies the license server configuration.
    2. Script Preparation converts processing scripts to CRLF line endings and ensures all file paths use ASCII characters.
    3. Pipeline Execution initiates a subprocess to pipe .compile and execution commands directly into the IDL kernel.
    4. GUI Capture triggers the Windows screen snip overlay, automates a drag-and-drop selection, and exports the clipboard to PNG.

    Frameworks & tools

    This tool targets ENVI (5.6 and 6.2) and IDL (8.5 to 9.2). It utilizes Python for orchestration, leveraging subprocess for kernel communication, ctypes for Windows API interaction, and numpy for direct raster manipulation.

    Why this beats prompting it yourself

    Generic AI prompts often suggest outdated IDL flags or fail to account for the mandatory e = ENVI() initialization required in newer versions. This skill includes pre-tested logic for handling Windows-specific UI quirks and DPI scaling issues that typically break basic automation scripts.

    Use cases

    • Running large-scale satellite imagery classification in headless batch mode.
    • Automated extraction of urban land-use objects using FXSegmentation and rule-based filtering.
    • Generating high-quality, high-resolution visual reports from ENVI GUI dialogs.
    • Debugging IDL syntax errors caused by encoding mismatches or licensing issues.

    Known limitations

    Does not support non-ASCII characters in file paths due to IDL kernel restrictions. Headless execution of specific tasks like BinaryLTThresholdRaster may hang and requires Python-side calculation instead.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 14 days ago

    • Free with an Agensi account

    Software
    PythonGit

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Environment Variables
    Listed14 days ago

    What's inside

    Creator

    Shihao Yu

    Shihao Yu

    Frequently Asked Questions

    This skill solves common automation hurdles like broken CLI flags, DPI-related screenshot blur, and the 'headless hang' issues often found in ENVI's native Task engine by using a stabilized stdin piping framework.

    It is fully compatible with ENVI versions 5.6 through 6.2 and IDL versions 8.5 through 9.2, including logic to bridge API changes between these specific releases.

    Yes, the skill includes specialized modules for automated FXSegmentation using Edge and Quadtree algorithms, specifically optimized for high-resolution satellite and aerial imagery.

    The skill includes the core automation framework, a library of pre-tested IDL/Python bridge scripts, and an environment-probing tool to ensure your license and paths are correctly configured.

    No, the skill currently requires file paths to use ASCII characters due to underlying IDL kernel restrictions, and it is optimized for Windows-based environments for GUI-driven features.

    Setup is streamlined through an automated environment probe that auto-detects your ENVI installation, verifies your license server, and configures file encoding to prevent execution errors.

    New in Workflow Automation

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Workflow Automation.

    Free