# AI图片编辑 **Repository Path**: martin8/batch-image ## Basic Information - **Project Name**: AI图片编辑 - **Description**: 图片编辑工具,使用Ai的方法。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-17 - **Last Updated**: 2026-09-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
???? 中文 # AI Image Editor 基于 Electron 和 Vue 3 的跨平台桌面应用,支持批量 AI 图像处理。兼容 OpenAI、OpenRouter、阿里灵积模型广场、火山引擎等多个 AI 平台。 ## 功能特点 - **批量处理**:单次操作处理多张图片,支持进度跟踪 - **多平台支持**:OpenAI、OpenRouter、OkRouter、灵积模型广场、火山引擎、FreeModel 及自定义 OpenAI 兼容 API - **OpenAI Responses API**:支持 `gpt-image-2`、`gpt-4.1-mini` 等图像生成模型,可配置输出尺寸 - **智能图片压缩**:自动压缩、调整图片大小后上传,降低 API 费用 - **反幻觉提示词**:内置提示词前缀确保产品细节在编辑背景时保持不变 - **重试与恢复**:网络错误时自动重试(指数退避),支持仅重试失败文件 - **随时取消**:批量处理过程中可以优雅地停止 - **代理支持**:支持 HTTP/HTTPS 代理配置,解决部分地区访问限制 - **模板系统**:内置常见场景的提示词模板,支持变量替换 - **配置持久化**:API Key、偏好设置等通过 `electron-store` 本地加密存储 - **实时日志**:处理过程可视化,支持导出日志 - **跨平台**:支持 Windows、macOS、Linux ## 支持的平台 | 平台 | API 类型 | 支持模型 | 备注 | |------|----------|------------------|------| | **OpenAI 官方** | Images Edits / Responses | `gpt-image-2` `gpt-image-1` `dall-e-2`, `dall-e-3` | 完整尺寸支持 | | **OpenRouter** | Chat Completions | 多模态模型 | OpenAI 兼容接口 | | **OkRouter** | Chat Completions | 多模态模型 | OpenAI 兼容接口 | | **灵积模型广场** | 多模态生成 | `qwen-image-*`, `wanx2.1-image-edit` | 国内优化 | | **火山引擎** | Images Generations | 火山图像模型 | 支持 2K/4K 输出 | | **FreeModel** | Responses API | `gpt-image-2` | Responses API 生成 | | **自定义** | OpenAI 兼容 | 任意兼容模型 | 手动配置 Base URL | ## 环境要求 - Node.js v18 或更高 - npm 或 yarn - 对应平台的 API Key ## 安装 ```bash npm install ``` (可选)在项目根目录创建 `app-config.json` 配置文件: ```json { "openai": { "baseUrl": "https://api.openai.com/v1", "apiKey": "your_key_here", "defaultModel": "gpt-image-1" } } ``` > 应用主要使用 UI 中的设置面板配置。`app-config.json` 中的值仅在未通过 UI 配置时作为后备。 ## 使用方法 ### 开发调试 ```bash npm run dev ``` ### 打包发布 ```bash # 打包安装程序(Windows: NSIS,macOS: DMG,Linux: AppImage) npm run dist # 只打包免安装目录 npm run build ``` 打包结果位于 `dist-installer/` 目录。 ### 配置说明 1. 打开应用 → **Settings** - **Provider**:选择 AI 平台 - **API Key**:填入平台对应的 API Key - **Model**:选择模型(切换 Provider 时会自动加载模型列表) - **Base URL**:切换 Provider 时自动填充,仅在"自定义"模式下需手动填写 - **Proxy**:如需要代理请填写(如 `http://127.0.0.1:7890`) - **Test Connection**:处理前先测试连接可用性 ### 操作流程 1. 选择包含图片的源文件夹 2. 选择输出文件夹 3. 选择或编写提示词(可使用模板快速开始) 4. 选择图片尺寸 5. 点击 **Start** 开始批量处理 6. 查看进度、日志,必要时重试失败文件 ## 图片尺寸选项 | 尺寸 | 说明 | |------|------| | `auto` | 由 OpenAI 自动决定| | `1024x1024` | 正方形 (1:1) | | `1024x1536` | 竖屏 (2:3) | | `1536x1024` | 横屏 (3:2) | | `2048x2048` | 2K 正方形(OpenAI) | | `2048x1152` | 2K 宽屏(OpenAI) | | `3840x2160` | 4K(OpenAI) | | `2160x3840` | 4K 竖屏(OpenAI) | | `2K` | 火山引擎 2K | | `4K` | 火山引擎 4K | ## 项目结构 ``` batch-ai-image-editor/ ├── src/ │ ├── main/ │ │ ├── index.js # 主进程:IPC、配置、批量调度 │ │ └── processImage.js # 图像处理:各平台 API 调用 │ └── renderer/ │ ├── index.html # 界面 │ ├── index.js # 渲染进程逻辑 │ └── styles.css # 样式 ├── assets/ # 资源文件 ├── package.json # 依赖与构建配置 └── README.md # 本文件 ``` ## 技术栈 - **Electron** (^30.0.0)、**Vue 3** (^3.4.0)、**Element Plus** (^2.6.0) - **OpenAI SDK** (^6.36.0)、**Sharp** (^0.33.5)、**Axios** (^1.6.0) - **electron-store** (^8.1.0) ## 安全说明 - API Key 通过 `electron-store` 加密存储 - 使用 Electron 上下文隔离和安全 IPC 通信 - `app-config.json` 仅作为后备配置,非必需 ## 开源协议 MIT License
---
???? English # AI Image Editor A cross-platform desktop application for batch AI-powered image editing, built with Electron and Vue 3. Supports multiple AI providers including OpenAI, OpenRouter, Alibaba DashScope, Volcengine, and more. ## Features - **Batch Processing**: Process multiple images in a single operation with progress tracking - **Multi-Provider Support**: Compatible with OpenAI, OpenRouter, OkRouter, Alibaba DashScope, Volcengine, FreeModel, and custom OpenAI-compatible APIs - **OpenAI Responses API**: Supports `gpt-image-1`, `gpt-4.1-mini`, and other image generation models via the Responses API with configurable size parameters - **Smart Image Compression**: Automatically compresses and resizes images before uploading to reduce API costs and avoid size limits - **Anti-Hallucination Prompts**: Built-in prompt prefix ensures product details are preserved during background editing - **Retry & Resume**: Automatically retries on network errors (5xx, 429) with exponential backoff; supports retrying failed files only - **Cancel Support**: Gracefully stop batch processing mid-operation - **Proxy Support**: HTTP/HTTPS proxy configuration for regions with restricted API access - **Template System**: Built-in prompt templates for common use cases - **Variable Replacement**: Supports `[Product Name]` and other variables in prompt templates - **Persistent Config**: Settings, API keys, and preferences are saved locally via `electron-store` - **Log Output**: Real-time processing logs with export capability - **Cross-Platform**: Runs on Windows, macOS, and Linux ## Supported Providers | Provider | API Type | Supported Models | Notes | |----------|----------|------------------|-------| | **OpenAI Official** | Images Edits / Responses | `dall-e-2`, `dall-e-3`, `gpt-image-1`, `gpt-4.1-mini` | Full size support (auto, 1024x1024, 2048x2048, 3840x2160) | | **OpenRouter** | Chat Completions | Various multimodal models | OpenAI-compatible endpoint | | **OkRouter** | Chat Completions | Various multimodal models | OpenAI-compatible endpoint | | **Alibaba DashScope** | Multimodal Generation | `qwen-image-*`, `wanx2.1-image-edit` | Chinese region optimized | | **Volcengine** | Images Generations | Volcengine image models | Supports 2K/4K output | | **FreeModel** | Responses API | `gpt-image-2` | Image generation via Responses API | | **Custom** | OpenAI-compatible | Any compatible model | Manual base URL configuration | ## Prerequisites - Node.js (v18 or higher) - npm or yarn - OpenAI API key (or equivalent for your chosen provider) ## Installation ```bash npm install ``` (Optional) Create an `app-config.json` file in the root directory: ```json { "openai": { "baseUrl": "https://api.openai.com/v1", "apiKey": "your_key_here", "defaultModel": "gpt-image-1" } } ``` > The app primarily uses settings configured via the UI (Settings panel). The `app-config.json` values are only used as a fallback when no API key is configured in the app. ## Usage ### Development ```bash npm run dev ``` ### Build for Distribution ```bash # Build installer (Windows: NSIS, macOS: DMG, Linux: AppImage) npm run dist # Build unpacked directory only npm run build ``` Packaged output is in the `dist-installer/` folder. ### Configuration 1. **Settings Panel** (recommended): Open the app → Settings - **Provider**: Select your AI platform - **API Key**: Enter your provider's API key - **Model**: Choose a supported model (auto-populated by provider) - **Base URL**: Auto-filled when switching providers; customize for private deployments - **Proxy**: Enter proxy URL if needed (e.g., `http://127.0.0.1:7890`) - **Test Connection**: Verify connectivity before processing ### Workflow 1. Select source folder containing images 2. Select output folder for processed images 3. Choose or write a prompt (use templates for quick start) 4. Select image size (provider-specific options available) 5. Click **Start** to begin batch processing 6. Monitor progress, view logs, and retry failed files if needed ## Image Size Options | Size | Description | |------|-------------| | `auto` | Let OpenAI decide (OpenAI Official-1) | | `1024x1024` | Square (1:1) | | `1024x1536` | Portrait (2:3) | | `1536x1024` | Landscape (3:2) | | `2048x2048` | 2K Square (OpenAI) | | `2048x1152` | 2K Widescreen (OpenAI) | | `3840x2160` | 4K (OpenAI) | | `2160x3840` | 4K Portrait (OpenAI) | | `2K` | Volcengine 2K | | `4K` | Volcengine 4K | ## Project Structure ``` batch-ai-image-editor/ ├── src/ │ ├── main/ │ │ ├── index.js # Main process: IPC, config, batch orchestration │ │ └── processImage.js # Image processing: API calls per provider │ └── renderer/ │ ├── index.html # Main UI │ ├── index.js # Renderer process logic │ └── styles.css # Styles ├── assets/ # Application assets (icons, etc.) ├── package.json # Dependencies and build config └── README.md # This file ``` ## Technologies Used - **Electron** (^30.0.0), **Vue 3** (^3.4.0), **Element Plus** (^2.6.0) - **OpenAI SDK** (^6.36.0), **Sharp** (^0.33.5), **Axios** (^1.6.0) - **electron-store** (^8.1.0) ## Security - API keys are stored in `electron-store` (encrypted on supported platforms) - Application uses Electron context isolation and secure IPC communication - `app-config.json` is optional and acts as a fallback only ## License MIT License