@apresai/gimage-mcp 1.2.65 → 1.2.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/gimage-mcp.js +55 -0
- package/package.json +1 -1
- package/bin/CHANGELOG.md +0 -374
- package/bin/LICENSE +0 -21
- package/bin/README.md +0 -825
- package/bin/gimage +0 -0
- package/bin/gimage-deploy +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
function getBinaryPath() {
|
|
8
|
+
const platform = process.platform;
|
|
9
|
+
const ext = platform === 'win32' ? '.exe' : '';
|
|
10
|
+
const binaryName = `gimage${ext}`;
|
|
11
|
+
|
|
12
|
+
// Try package-installed binary first
|
|
13
|
+
const packagePath = path.join(__dirname, '..', 'bin', binaryName);
|
|
14
|
+
if (fs.existsSync(packagePath)) {
|
|
15
|
+
return packagePath;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Fall back to system PATH (if gimage is installed globally via Homebrew, etc.)
|
|
19
|
+
return 'gimage';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function main() {
|
|
23
|
+
const binaryPath = getBinaryPath();
|
|
24
|
+
|
|
25
|
+
// Spawn gimage serve command
|
|
26
|
+
const child = spawn(binaryPath, ['serve'], {
|
|
27
|
+
stdio: 'inherit',
|
|
28
|
+
env: process.env
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
child.on('error', (error) => {
|
|
32
|
+
console.error('Failed to start gimage MCP server:', error.message);
|
|
33
|
+
console.error('\nPlease ensure gimage is installed:');
|
|
34
|
+
console.error(' npm install -g @apresai/gimage-mcp');
|
|
35
|
+
console.error(' or');
|
|
36
|
+
console.error(' brew install gimage');
|
|
37
|
+
console.error('\nFor manual installation, see: https://github.com/apresai/gimage');
|
|
38
|
+
process.exit(1);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
child.on('exit', (code) => {
|
|
42
|
+
process.exit(code || 0);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Handle signals for graceful shutdown
|
|
46
|
+
process.on('SIGINT', () => {
|
|
47
|
+
child.kill('SIGINT');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
process.on('SIGTERM', () => {
|
|
51
|
+
child.kill('SIGTERM');
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
main();
|
package/package.json
CHANGED
package/bin/CHANGELOG.md
DELETED
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [Unreleased]
|
|
9
|
-
|
|
10
|
-
(empty - ready for next release)
|
|
11
|
-
|
|
12
|
-
## [1.2.63] - 2025-11-06
|
|
13
|
-
|
|
14
|
-
### Changed
|
|
15
|
-
|
|
16
|
-
- **Generate command**: Now accepts positional prompt argument (`gimage generate "sunset"`) in addition to flag-based prompt (`--prompt`) for improved UX
|
|
17
|
-
- **Auth commands**: Refactored into modular structure with new dedicated `auth status` command providing detailed credential information
|
|
18
|
-
- **CLI verbose output**: Improved formatting and consistency across all image processing commands (resize, crop, scale, compress, convert)
|
|
19
|
-
- **Configuration**: Streamlined config management, removing legacy config command in favor of auth commands
|
|
20
|
-
- **Documentation**: Comprehensive overhaul of README.md, COMMANDS.md, CLAUDE.md, and MCP_USAGE.md with clearer examples and better organization
|
|
21
|
-
- **Integration tests**: Updated CLI E2E tests to use new positional prompt syntax
|
|
22
|
-
|
|
23
|
-
### Removed
|
|
24
|
-
|
|
25
|
-
- **Batch CLI commands**: Removed `gimage batch` command (batch operations now exclusively through MCP server)
|
|
26
|
-
- **TUI batch menu**: Removed batch processing UI from TUI (use MCP server batch tools instead)
|
|
27
|
-
- **Batch history tracking**: Removed history persistence system (`internal/batch/history.go` and tests)
|
|
28
|
-
- **Documentation files**: Removed 12 planning/implementation docs (DESIGN.md, IMPLEMENTATION_SUMMARY.md, PRODUCTION_QUALITY_FIXES.md, TUI_FEATURE_TOUR.md, TUI_IMPLEMENTATION_SUMMARY.md, TESTING.md, lambda.md, tui.md, npm/README.md, test/integration/README.md, internal/generate/README.md, INTEGRATION_GUIDE.md) - ~14,000 lines total
|
|
29
|
-
- **Config command**: Removed legacy `gimage config` subcommand
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
## [1.2.61] - 2025-11-05
|
|
33
|
-
|
|
34
|
-
### Changed
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## [1.2.60] - 2025-11-05
|
|
39
|
-
|
|
40
|
-
### Added
|
|
41
|
-
- Imagen 3 models support (`imagen-3.0-generate-001`, `imagen-3.0-generate-002`, `imagen-3.0-fast-generate-001`)
|
|
42
|
-
- Model alias `imagen-3` for latest Imagen 3 model
|
|
43
|
-
- Enhanced MCP end-to-end test coverage with model metadata validation
|
|
44
|
-
|
|
45
|
-
### Changed
|
|
46
|
-
- Updated model registry with comprehensive Imagen 3 and Imagen 4 model definitions
|
|
47
|
-
- Improved provider auto-detection logic to handle both Imagen 3 and Imagen 4 models
|
|
48
|
-
- Streamlined `models_test.go` using table-driven tests (197 → 151 lines)
|
|
49
|
-
|
|
50
|
-
### Fixed
|
|
51
|
-
- Resolved logger deadlock in auth commands by deferring stdout restoration
|
|
52
|
-
- Fixed test suite reliability issues in model registry tests
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
## [1.2.58] - 2025-11-05
|
|
56
|
-
|
|
57
|
-
### Added
|
|
58
|
-
- **Provider System**: New architecture for AI backends with clean abstraction layer for Gemini, Vertex AI, and AWS Bedrock
|
|
59
|
-
- **Model Registry**: Centralized system for model management and auto-detection
|
|
60
|
-
- **Enhanced Auth Commands**:
|
|
61
|
-
- `auth list` - Display all configured credentials and their status
|
|
62
|
-
- `auth setup` - Interactive setup wizard for configuring providers
|
|
63
|
-
- `auth test` - Validate credentials and test API connectivity
|
|
64
|
-
- **Design Documentation**: Added `DESIGN.md` documenting provider architecture and patterns
|
|
65
|
-
|
|
66
|
-
### Changed
|
|
67
|
-
- **Major Refactor**: Migrated from monolithic `models.go` (643 lines) to modular `providers.go` (565 lines) with cleaner separation
|
|
68
|
-
- **Auth Command Structure**: Reorganized authentication commands with new subcommands for better UX
|
|
69
|
-
- **Generate Command**: Enhanced with improved provider selection logic and better error handling
|
|
70
|
-
- **MCP Server**: Updated tools and prompts to work with new provider system
|
|
71
|
-
- **Logging**: Improved context and verbosity handling across components
|
|
72
|
-
|
|
73
|
-
### Removed
|
|
74
|
-
- **Legacy Code**: Removed old model management system (`internal/generate/models.go` and tests)
|
|
75
|
-
- **Test Files**: Cleaned up automated TUI tests (`automated_test.go`, `debug_test.go`)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
## [1.1.54] - 2025-11-05
|
|
79
|
-
|
|
80
|
-
### Fixed
|
|
81
|
-
- TUI image generation now works correctly by switching from SDK to REST client for API calls
|
|
82
|
-
- Enhanced TUI generation flow with improved error handling and progress feedback
|
|
83
|
-
|
|
84
|
-
### Added
|
|
85
|
-
- Comprehensive logging system for debugging TUI operations
|
|
86
|
-
- Automated testing suite for TUI image generation workflows
|
|
87
|
-
- Debug mode support with detailed operation logging
|
|
88
|
-
- Progress indicators and status messages during image generation
|
|
89
|
-
|
|
90
|
-
### Changed
|
|
91
|
-
- Refactored TUI generation flow to use REST client instead of SDK for better reliability
|
|
92
|
-
- Improved TUI styles and visual feedback during operations
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
## [1.1.52] - 2025-11-05
|
|
96
|
-
|
|
97
|
-
### Added
|
|
98
|
-
- macOS keyboard shortcuts for improved navigation
|
|
99
|
-
- Settings navigation menu for easier configuration access
|
|
100
|
-
- Editable API keys in settings interface
|
|
101
|
-
|
|
102
|
-
### Changed
|
|
103
|
-
- Enhanced error handling in generate flow
|
|
104
|
-
- Improved settings menu UI and functionality
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
## [1.1.50] - 2025-11-05
|
|
108
|
-
|
|
109
|
-
### Changed
|
|
110
|
-
- Updated Go dependencies to resolve test compatibility issues
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
## [1.1.48] - 2025-11-05
|
|
114
|
-
|
|
115
|
-
### Fixed
|
|
116
|
-
|
|
117
|
-
- Add context.Context parameter to test function calls for proper context handling in image processing tests
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
## [1.1.46] - 2025-11-05
|
|
121
|
-
|
|
122
|
-
```markdown
|
|
123
|
-
## [Unreleased]
|
|
124
|
-
|
|
125
|
-
### Added
|
|
126
|
-
- Interactive TUI (Terminal User Interface) with main menu, batch processing, generation flow, and settings management
|
|
127
|
-
- Batch operation history tracking with persistent storage
|
|
128
|
-
- Progress reporter for real-time operation feedback
|
|
129
|
-
- Production quality test suite with comprehensive integration tests
|
|
130
|
-
- Image compression operation with quality control
|
|
131
|
-
- TUI documentation and feature tour
|
|
132
|
-
- Test fixtures (small_test.png, test_image.png, test_image_512x512.png)
|
|
133
|
-
|
|
134
|
-
### Changed
|
|
135
|
-
- Simplified CLI command outputs for better TUI integration
|
|
136
|
-
- Improved image processing operations (resize, scale, crop, convert) with enhanced error handling
|
|
137
|
-
- Streamlined documentation: consolidated guides into concise references
|
|
138
|
-
- Reduced project documentation by 56% (removed planning and implementation tracking docs)
|
|
139
|
-
- Updated lambda.md from 1,385 to 272 lines (removed CDK code, kept deployment guide)
|
|
140
|
-
- Updated INTEGRATION_GUIDE.md to focus on crisp examples only
|
|
141
|
-
|
|
142
|
-
### Removed
|
|
143
|
-
- Project planning documents (RELEASING.md, roadmap.md, HOMEBREW.md)
|
|
144
|
-
- Implementation tracking docs (DEPLOYMENT_CHECKLIST.md, LAMBDA_STATUS.md)
|
|
145
|
-
- Research/analysis docs (MCP_LLM_LEARNING_ANALYSIS.md, AI_TOOL_CALLING_IMPROVEMENTS.md, AWS_BEDROCK_SDK_GUIDE.md, etc.)
|
|
146
|
-
- Redundant documentation (API_REFERENCE.md, SWAGGER_SETUP.md, RELEASE_NOTES.md, etc.)
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
## [1.1.43] - 2025-11-02
|
|
151
|
-
|
|
152
|
-
### Added
|
|
153
|
-
|
|
154
|
-
- MCP Prompts feature: New prompt templates for image generation, batch processing, and common workflows
|
|
155
|
-
- MCP server now exposes 13 prompt templates via the prompts/list capability
|
|
156
|
-
- Comprehensive documentation for MCP Prompts design and implementation (MCP_PROMPTS_DESIGN.md, MCP_PROMPTS_IMPLEMENTATION.md)
|
|
157
|
-
- Analysis documentation for LLM learning patterns with MCP (MCP_LLM_LEARNING_ANALYSIS.md)
|
|
158
|
-
|
|
159
|
-
### Changed
|
|
160
|
-
|
|
161
|
-
- Enhanced MCP tool descriptions with more actionable guidance for LLM clients
|
|
162
|
-
- Improved MCP handler with prompt list and get capabilities
|
|
163
|
-
- Updated MCP server to register prompt templates on initialization
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
## [1.1.41] - 2025-11-02
|
|
167
|
-
|
|
168
|
-
### Changed
|
|
169
|
-
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
## [1.1.40] - 2025-11-02
|
|
173
|
-
|
|
174
|
-
### Changed
|
|
175
|
-
- Build number incremented to 1.1.40 (automatic versioning from git commit count)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
## [1.1.38] - 2025-11-02
|
|
179
|
-
|
|
180
|
-
### Changed
|
|
181
|
-
- Upgraded GoReleaser configuration to v2 format for improved build and release automation
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
## [1.1.36] - 2025-11-02
|
|
185
|
-
|
|
186
|
-
### Changed
|
|
187
|
-
- Build number incremented to 1.1.36 (automatic versioning from git commit count)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
## [1.1.34] - 2025-11-02
|
|
191
|
-
|
|
192
|
-
### Changed
|
|
193
|
-
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
## [1.1.33] - 2025-11-02
|
|
197
|
-
|
|
198
|
-
### Changed
|
|
199
|
-
- Updated .gitignore patterns for improved exclusion rules
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
## [1.1.32] - 2025-11-02
|
|
203
|
-
|
|
204
|
-
### Added
|
|
205
|
-
|
|
206
|
-
- AWS Bedrock Nova Canvas integration with dual implementation modes (REST and SDK)
|
|
207
|
-
- AWS Bedrock authentication setup via `gimage auth bedrock` command
|
|
208
|
-
- Nova Canvas model support (`amazon.nova-canvas-v1:0`) with quality presets (standard/premium)
|
|
209
|
-
- Advanced generation controls: negative prompts, CFG scale, seed, and quality settings
|
|
210
|
-
- Comprehensive AWS Bedrock documentation (SDK guide, quickstart, onboarding guide)
|
|
211
|
-
- Testing infrastructure with coverage reporting tools (`cmd/coverage-report`, `cmd/test-report`, `cmd/test-summary`)
|
|
212
|
-
- Extensive test suites for Bedrock REST and SDK clients (382+ and 305+ test cases respectively)
|
|
213
|
-
- MCP tools test coverage (batch, convert, generate operations)
|
|
214
|
-
- End-to-end integration tests for CLI and generation workflows
|
|
215
|
-
- Testing best practices documentation (TESTING.md)
|
|
216
|
-
- Model onboarding guide (MODEL_ONBOARDING.md) for adding new backends
|
|
217
|
-
- Documentation index (DOCUMENTATION_INDEX.md) for centralized reference
|
|
218
|
-
- Coverage report scripts with detailed HTML output
|
|
219
|
-
|
|
220
|
-
### Changed
|
|
221
|
-
|
|
222
|
-
- Updated CLAUDE.md with multi-backend architecture guidance and AWS Bedrock sections
|
|
223
|
-
- Enhanced `gimage generate` command with AWS-specific flags (quality, seed, CFG scale, negative prompts)
|
|
224
|
-
- Expanded configuration system to support AWS credentials and region settings
|
|
225
|
-
- Updated README.md with AWS Bedrock usage examples
|
|
226
|
-
- Improved MCP_TOOLS.md with Bedrock integration examples
|
|
227
|
-
- Enhanced Makefile with test coverage and reporting targets
|
|
228
|
-
- Refactored generate models to support backend-specific options
|
|
229
|
-
- Updated auth.go with Bedrock credential management (REST and SDK modes)
|
|
230
|
-
|
|
231
|
-
### Fixed
|
|
232
|
-
|
|
233
|
-
- Image scaling operations with improved precision
|
|
234
|
-
- Crop and scale CLI commands with better error handling
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
## [1.1.29] - 2025-11-02
|
|
238
|
-
|
|
239
|
-
### Changed
|
|
240
|
-
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
## [1.1.28] - 2025-11-02
|
|
244
|
-
|
|
245
|
-
### Changed
|
|
246
|
-
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
## [1.1.27] - 2025-11-02
|
|
250
|
-
|
|
251
|
-
### Changed
|
|
252
|
-
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
## [1.1.26] - 2025-11-02
|
|
256
|
-
|
|
257
|
-
### Removed
|
|
258
|
-
- Removed MCP tool tests (convert_test.go, generate_test.go, models_test.go) that were incompatible with current implementation
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
## [1.1.23] - 2025-11-02
|
|
262
|
-
|
|
263
|
-
### Added
|
|
264
|
-
- Comprehensive model pricing and announcement system with cost tracking and latest model information
|
|
265
|
-
- Unit tests for generate command with coverage for both Gemini and Vertex AI backends
|
|
266
|
-
- Unit tests for convert operation with format conversion validation
|
|
267
|
-
- Unit tests for resize operation with comprehensive dimension and format testing
|
|
268
|
-
- Unit tests for crop operation with boundary and validation testing
|
|
269
|
-
- Automated changelog update script for release process
|
|
270
|
-
|
|
271
|
-
### Changed
|
|
272
|
-
- Enhanced generate command with model pricing display and cost estimation
|
|
273
|
-
- Improved MCP server with model information and pricing details
|
|
274
|
-
- Updated RELEASING.md with streamlined release workflow and automation improvements
|
|
275
|
-
- Refactored Makefile with improved test coverage reporting and build targets
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
## [1.1.19] - 2025-11-02
|
|
279
|
-
|
|
280
|
-
### Changed
|
|
281
|
-
- Build number incremented to 1.1.19 (automatic versioning from git commit count)
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
## [1.1.18] - 2025-11-01
|
|
285
|
-
|
|
286
|
-
### Changed
|
|
287
|
-
- Build number incremented to 1.1.18 (automatic versioning from git commit count)
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
## [1.1.9] - 2025-11-01
|
|
291
|
-
|
|
292
|
-
### Added
|
|
293
|
-
- **Automated version synchronization** between CLI and npm package
|
|
294
|
-
- **Build number versioning** using git commit count (format: 1.1.[build])
|
|
295
|
-
- WebP support via nativewebp library (pure Go, zero C dependencies)
|
|
296
|
-
- CLI `convert` command for format conversion
|
|
297
|
-
- Comprehensive integration tests for WebP
|
|
298
|
-
- End-to-end tests for all 10 MCP tools
|
|
299
|
-
- Help text displayed when running `gimage` with no arguments
|
|
300
|
-
- Complete release automation with GoReleaser
|
|
301
|
-
- GitHub Actions workflows for CI and releases
|
|
302
|
-
- npm package for MCP server distribution
|
|
303
|
-
- Homebrew tap for macOS/Linux distribution
|
|
304
|
-
- Comprehensive RELEASING.md guide
|
|
305
|
-
- `make version` and `make sync-version` commands
|
|
306
|
-
|
|
307
|
-
### Changed
|
|
308
|
-
- **Version numbering scheme** to 1.1.[commit_count] for automatic sync
|
|
309
|
-
- Root command now shows help instead of crashing when run without arguments
|
|
310
|
-
- All MCP tools now support WebP output format
|
|
311
|
-
- Homebrew tap repository renamed to `homebrew-tap` (conventional naming)
|
|
312
|
-
- Documentation updated for new distribution methods
|
|
313
|
-
|
|
314
|
-
### Fixed
|
|
315
|
-
- Root command exit behavior
|
|
316
|
-
- WebP encoding in all contexts (CLI, MCP server, programmatic usage)
|
|
317
|
-
- Version synchronization between CLI binary and npm package
|
|
318
|
-
|
|
319
|
-
## [0.1.1] - 2025-11-01
|
|
320
|
-
|
|
321
|
-
### Added
|
|
322
|
-
- Automatic format conversion based on output file extension
|
|
323
|
-
- Specify `-o output.jpg` to save as JPEG
|
|
324
|
-
- Specify `-o output.png` to save as PNG
|
|
325
|
-
- Specify `-o output.gif` to save as GIF
|
|
326
|
-
- Specify `-o output.bmp` to save as BMP
|
|
327
|
-
- Specify `-o output.tiff` to save as TIFF
|
|
328
|
-
- Intelligent transparency handling (converts transparent areas to white when saving to formats that don't support transparency)
|
|
329
|
-
- Format normalization (automatically handles .jpg vs .jpeg, .tif vs .tiff)
|
|
330
|
-
|
|
331
|
-
### Changed
|
|
332
|
-
- SaveImage now automatically converts image format based on file extension
|
|
333
|
-
|
|
334
|
-
## [0.1.0] - 2025-11-01
|
|
335
|
-
|
|
336
|
-
### Added
|
|
337
|
-
- Initial release of gimage CLI tool
|
|
338
|
-
- AI-powered image generation using Google Gemini 2.5 Flash Image
|
|
339
|
-
- AI-powered image generation using Vertex AI Imagen 4
|
|
340
|
-
- Image processing operations:
|
|
341
|
-
- Resize: Change image dimensions
|
|
342
|
-
- Scale: Scale by percentage
|
|
343
|
-
- Crop: Extract specific regions
|
|
344
|
-
- Compress: Reduce file size
|
|
345
|
-
- Batch processing with concurrent operations
|
|
346
|
-
- MCP server for Claude integration
|
|
347
|
-
- Support for multiple image formats: PNG, JPG, WebP, GIF, TIFF, BMP
|
|
348
|
-
- Pure Go implementation with zero C dependencies
|
|
349
|
-
- Cross-platform support (Linux, macOS, Windows, ARM)
|
|
350
|
-
- Interactive authentication setup:
|
|
351
|
-
- `gimage auth gemini` - Gemini API key setup
|
|
352
|
-
- `gimage auth vertex` - Vertex AI setup (Express Mode or Full Mode)
|
|
353
|
-
- Smart credential detection - auto-selects API based on available credentials
|
|
354
|
-
- Configuration system with markdown-based config file (~/.gimage/config.md)
|
|
355
|
-
- Comprehensive CLI with Cobra framework
|
|
356
|
-
|
|
357
|
-
### Features
|
|
358
|
-
- Text-to-image generation with customizable prompts
|
|
359
|
-
- Multiple generation styles: photorealistic, artistic, anime
|
|
360
|
-
- Configurable image sizes and aspect ratios
|
|
361
|
-
- Negative prompts for image generation
|
|
362
|
-
- Seed support for reproducible results
|
|
363
|
-
- Verbose mode for debugging
|
|
364
|
-
- Model listing and auto-detection
|
|
365
|
-
- Express Mode for Vertex AI (API key authentication)
|
|
366
|
-
- Full Mode for Vertex AI (service account authentication)
|
|
367
|
-
|
|
368
|
-
### Technical
|
|
369
|
-
- Built with Go 1.22+
|
|
370
|
-
- Uses disintegration/imaging library for image processing
|
|
371
|
-
- Gemini API integration via REST
|
|
372
|
-
- Vertex AI integration via REST (Express Mode) and SDK (Full Mode)
|
|
373
|
-
- Concurrent batch processing with worker pools
|
|
374
|
-
- Comprehensive error handling and validation
|
package/bin/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Chad Masso
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/bin/README.md
DELETED
|
@@ -1,825 +0,0 @@
|
|
|
1
|
-
# Gimage - AI-Powered Image Generation and Processing
|
|
2
|
-
|
|
3
|
-
**Gimage** is a powerful tool for generating AI images and processing them with ease. Built with pure Go for maximum portability.
|
|
4
|
-
|
|
5
|
-
## 🚀 Three Ways to Use Gimage
|
|
6
|
-
|
|
7
|
-
### 1. Command-Line Tool (CLI)
|
|
8
|
-
A single binary with zero dependencies for local image operations on your computer.
|
|
9
|
-
|
|
10
|
-
### 2. MCP Server for AI Assistants
|
|
11
|
-
Run as an MCP (Model Context Protocol) server for seamless integration with Claude Desktop and other AI assistants.
|
|
12
|
-
|
|
13
|
-
### 3. Cloud API (AWS Lambda)
|
|
14
|
-
Production-ready serverless REST API for web applications and remote processing.
|
|
15
|
-
|
|
16
|
-
## What Can You Do with Gimage?
|
|
17
|
-
|
|
18
|
-
### 🎨 AI Image Generation
|
|
19
|
-
- Generate stunning images from text prompts using Google Gemini, Vertex AI, or AWS Bedrock
|
|
20
|
-
- Multiple AI models: Gemini 2.5 Flash, Imagen 3, Imagen 4, Nova Canvas
|
|
21
|
-
- Control size, style, quality, and use negative prompts
|
|
22
|
-
- Reproducible results with seed values
|
|
23
|
-
|
|
24
|
-
### 🛠️ Image Processing
|
|
25
|
-
- **Resize** - Change image dimensions with high-quality resampling
|
|
26
|
-
- **Scale** - Scale images by factor (2x, 0.5x, etc.)
|
|
27
|
-
- **Crop** - Extract specific regions from images
|
|
28
|
-
- **Compress** - Reduce file size while maintaining quality
|
|
29
|
-
- **Convert** - Transform between formats (PNG, JPG, WebP, GIF, TIFF, BMP)
|
|
30
|
-
|
|
31
|
-
### ⚡ Batch Processing (MCP Server Only)
|
|
32
|
-
- Process multiple images concurrently via MCP server
|
|
33
|
-
- Optimized for AI assistants (Claude Desktop)
|
|
34
|
-
- CLI users: use shell scripts or `find` + `xargs`
|
|
35
|
-
|
|
36
|
-
### 🔌 Integration Options
|
|
37
|
-
- **Claude Desktop**: Run as MCP server
|
|
38
|
-
- **Web Applications**: REST API via AWS Lambda
|
|
39
|
-
- **Serverless**: AWS Lambda on ARM64/Graviton2
|
|
40
|
-
|
|
41
|
-
## Quick Start - CLI
|
|
42
|
-
|
|
43
|
-
### 1. Installation
|
|
44
|
-
|
|
45
|
-
#### Homebrew (macOS/Linux) - Recommended
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
# Install gimage (tap is added automatically)
|
|
49
|
-
brew install apresai/tap/gimage
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
#### Upgrade via Homebrew
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
brew upgrade apresai/tap/gimage
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
#### Manual Installation
|
|
59
|
-
|
|
60
|
-
Download the latest release for your platform:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
# macOS (Intel)
|
|
64
|
-
curl -L https://github.com/apresai/gimage/releases/latest/download/gimage-darwin-amd64 -o gimage
|
|
65
|
-
chmod +x gimage
|
|
66
|
-
sudo mv gimage /usr/local/bin/
|
|
67
|
-
|
|
68
|
-
# macOS (Apple Silicon)
|
|
69
|
-
curl -L https://github.com/apresai/gimage/releases/latest/download/gimage-darwin-arm64 -o gimage
|
|
70
|
-
chmod +x gimage
|
|
71
|
-
sudo mv gimage /usr/local/bin/
|
|
72
|
-
|
|
73
|
-
# Linux
|
|
74
|
-
curl -L https://github.com/apresai/gimage/releases/latest/download/gimage-linux-amd64 -o gimage
|
|
75
|
-
chmod +x gimage
|
|
76
|
-
sudo mv gimage /usr/local/bin/
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### 2. Setup Authentication
|
|
80
|
-
|
|
81
|
-
**Quick Start** (recommended for most users):
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
# Get a free Gemini API key from https://aistudio.google.com/app/apikey
|
|
85
|
-
# Then run the interactive setup:
|
|
86
|
-
gimage auth setup gemini
|
|
87
|
-
|
|
88
|
-
# Or use environment variable (more secure):
|
|
89
|
-
export GEMINI_API_KEY="your-api-key-here"
|
|
90
|
-
gimage generate "test sunset"
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**Check your configuration:**
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
# Check current authentication status
|
|
97
|
-
gimage auth status
|
|
98
|
-
|
|
99
|
-
# List all configured providers with pricing
|
|
100
|
-
gimage auth list
|
|
101
|
-
|
|
102
|
-
# Test your credentials
|
|
103
|
-
gimage auth test gemini
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
**Get API Keys:**
|
|
107
|
-
- **Gemini API**: https://aistudio.google.com/app/apikey (FREE tier: 1500 requests/day, no credit card)
|
|
108
|
-
- **Vertex AI**: https://cloud.google.com/vertex-ai (3 auth modes: Express Mode/Service Account/Application Default Credentials)
|
|
109
|
-
- **AWS Bedrock**: https://console.aws.amazon.com/bedrock (4 auth modes: Bearer Token/Access Keys/Profile/IAM Role)
|
|
110
|
-
|
|
111
|
-
### 3. Generate Your First Image
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
gimage generate "a sunset over mountains with vibrant colors"
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
That's it! Your image will be saved as `generated_<timestamp>.png`
|
|
118
|
-
|
|
119
|
-
## Examples
|
|
120
|
-
|
|
121
|
-
### Image Generation
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
# Basic generation (positional prompt - most common)
|
|
125
|
-
gimage generate "futuristic city at night"
|
|
126
|
-
|
|
127
|
-
# Specify size and style
|
|
128
|
-
gimage generate "abstract art" --size 1024x1024 --style photorealistic
|
|
129
|
-
|
|
130
|
-
# Use Vertex AI Imagen 4 (auto-detects vertex API)
|
|
131
|
-
gimage generate "beautiful landscape" --model imagen-4
|
|
132
|
-
|
|
133
|
-
# Use AWS Bedrock Nova Canvas with premium quality
|
|
134
|
-
gimage generate "futuristic robot" --model nova-canvas --quality premium
|
|
135
|
-
|
|
136
|
-
# Use negative prompts to avoid unwanted elements
|
|
137
|
-
gimage generate "forest scene" --negative "people, buildings"
|
|
138
|
-
|
|
139
|
-
# Reproducible results with seed
|
|
140
|
-
gimage generate "random pattern" --seed 12345
|
|
141
|
-
|
|
142
|
-
# Control creativity with CFG scale (Nova Canvas)
|
|
143
|
-
gimage generate "abstract art" --model nova-canvas --cfg-scale 10
|
|
144
|
-
|
|
145
|
-
# List all available models with pricing
|
|
146
|
-
gimage generate --list-models
|
|
147
|
-
|
|
148
|
-
# Or use explicit --prompt flag if preferred
|
|
149
|
-
gimage generate --prompt "your prompt here"
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Image Processing
|
|
153
|
-
|
|
154
|
-
All image processing commands use explicit flags for clarity:
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
# Resize to specific dimensions
|
|
158
|
-
gimage resize --input photo.jpg --width 800 --height 600
|
|
159
|
-
|
|
160
|
-
# Scale to 50% size
|
|
161
|
-
gimage scale --input photo.jpg --factor 0.5
|
|
162
|
-
|
|
163
|
-
# Crop a region
|
|
164
|
-
gimage crop --input photo.jpg --x 100 --y 100 --width 800 --height 600
|
|
165
|
-
|
|
166
|
-
# Compress with custom quality (supports JPG and WebP)
|
|
167
|
-
gimage compress --input photo.jpg --quality 85
|
|
168
|
-
|
|
169
|
-
# Convert format
|
|
170
|
-
gimage convert --input photo.png --format jpg
|
|
171
|
-
|
|
172
|
-
# Use --output to specify custom output path
|
|
173
|
-
gimage resize --input photo.jpg --width 800 --height 600 --output resized.jpg
|
|
174
|
-
|
|
175
|
-
# Add --verbose for detailed progress
|
|
176
|
-
gimage convert --input photo.png --format webp --verbose
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
### Batch Processing
|
|
180
|
-
|
|
181
|
-
**Batch operations are available only through the MCP server** for use with AI assistants like Claude.
|
|
182
|
-
|
|
183
|
-
For CLI users who need batch processing:
|
|
184
|
-
- Use shell scripts with loops
|
|
185
|
-
- Use `find` + `xargs` for parallel processing
|
|
186
|
-
- Example: `find photos/ -name "*.jpg" | xargs -P 4 -I {} gimage resize --input {} --width 800 --height 600`
|
|
187
|
-
|
|
188
|
-
MCP server batch tools (for AI assistants):
|
|
189
|
-
- `batch_resize` - Concurrent image resizing
|
|
190
|
-
- `batch_compress` - Concurrent compression
|
|
191
|
-
- `batch_convert` - Concurrent format conversion
|
|
192
|
-
|
|
193
|
-
See [MCP documentation](#mcp-server-for-ai-assistants) for details.
|
|
194
|
-
|
|
195
|
-
## Configuration
|
|
196
|
-
|
|
197
|
-
### Authentication Priority (Highest to Lowest)
|
|
198
|
-
1. **Command-line flags** (highest priority)
|
|
199
|
-
2. **Environment variables** (`GEMINI_API_KEY`, `VERTEX_API_KEY`, etc.)
|
|
200
|
-
3. **Config file** (`~/.gimage/config.md`)
|
|
201
|
-
4. **Default values** (lowest priority)
|
|
202
|
-
|
|
203
|
-
**Recommended**: Use environment variables for sensitive keys. Config file stores keys in **plaintext**.
|
|
204
|
-
|
|
205
|
-
### Config File
|
|
206
|
-
|
|
207
|
-
Location: `~/.gimage/config.md` (created automatically by `gimage auth` commands)
|
|
208
|
-
|
|
209
|
-
**Security Notes**:
|
|
210
|
-
- File permissions: 0600 (only you can read/write)
|
|
211
|
-
- Contains PLAINTEXT API keys
|
|
212
|
-
- **NEVER commit to version control**
|
|
213
|
-
- **PREFER environment variables** over config file
|
|
214
|
-
- Use `gimage auth status` to check for conflicting credentials
|
|
215
|
-
|
|
216
|
-
Format (markdown with `**key**: value`):
|
|
217
|
-
```markdown
|
|
218
|
-
# Gimage Configuration
|
|
219
|
-
|
|
220
|
-
⚠️ SECURITY WARNING ⚠️
|
|
221
|
-
This file contains SENSITIVE API KEYS stored in PLAINTEXT.
|
|
222
|
-
|
|
223
|
-
**gemini_api_key**: your-gemini-key
|
|
224
|
-
**vertex_api_key**: your-vertex-key
|
|
225
|
-
**vertex_project**: your-gcp-project
|
|
226
|
-
**vertex_location**: us-central1
|
|
227
|
-
**vertex_credentials_path**: /path/to/service-account.json
|
|
228
|
-
**aws_access_key_id**: AKIA...
|
|
229
|
-
**aws_secret_access_key**: wJalr...
|
|
230
|
-
**aws_region**: us-east-1
|
|
231
|
-
**aws_profile**: default
|
|
232
|
-
**aws_bedrock_api_key**: bearer-token
|
|
233
|
-
**default_api**: gemini
|
|
234
|
-
**default_model**: gemini-2.5-flash-image
|
|
235
|
-
**default_size**: 1024x1024
|
|
236
|
-
**log_level**: info
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### Environment Variables (Recommended)
|
|
240
|
-
|
|
241
|
-
**Gemini API**:
|
|
242
|
-
```bash
|
|
243
|
-
export GEMINI_API_KEY="your-key"
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
**Vertex AI** (3 authentication modes):
|
|
247
|
-
```bash
|
|
248
|
-
# Option 1: Express Mode (REST) - Simplest
|
|
249
|
-
export VERTEX_API_KEY="your-key"
|
|
250
|
-
export VERTEX_PROJECT="your-project-id"
|
|
251
|
-
export VERTEX_LOCATION="us-central1"
|
|
252
|
-
|
|
253
|
-
# Option 2: Service Account - Production
|
|
254
|
-
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
|
|
255
|
-
export VERTEX_PROJECT="your-project-id"
|
|
256
|
-
|
|
257
|
-
# Option 3: Application Default Credentials - gcloud SDK
|
|
258
|
-
# No env vars needed - uses gcloud auth
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
**AWS Bedrock** (4 authentication modes):
|
|
262
|
-
```bash
|
|
263
|
-
# Option 1: REST API with Bearer Token
|
|
264
|
-
export AWS_BEARER_TOKEN_BEDROCK="your-bearer-token"
|
|
265
|
-
export AWS_REGION="us-east-1"
|
|
266
|
-
|
|
267
|
-
# Option 2: SDK with Access Keys (supports both long-term and short-term credentials)
|
|
268
|
-
export AWS_ACCESS_KEY_ID="AKIA..." # Long-term access key ID
|
|
269
|
-
export AWS_SECRET_ACCESS_KEY="wJalr..." # Long-term secret access key
|
|
270
|
-
export AWS_SESSION_TOKEN="FwoGZXIvYXd..." # Optional: for short-term credentials
|
|
271
|
-
export AWS_REGION="us-east-1"
|
|
272
|
-
|
|
273
|
-
# Option 3: SDK with Named Profile
|
|
274
|
-
export AWS_PROFILE="your-profile-name"
|
|
275
|
-
export AWS_REGION="us-east-1"
|
|
276
|
-
|
|
277
|
-
# Option 4: SDK with IAM Role (Lambda/EC2/ECS - no credentials needed)
|
|
278
|
-
# Instance/task role automatically provides credentials
|
|
279
|
-
export AWS_REGION="us-east-1" # Optional, defaults to instance region
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
**Check credential conflicts**:
|
|
283
|
-
```bash
|
|
284
|
-
gimage auth status # Shows which credentials are active and their sources
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
## Available Models
|
|
288
|
-
|
|
289
|
-
### Gemini API (Google AI Studio) - FREE Tier
|
|
290
|
-
- **`gemini-2.5-flash-image`** (default, recommended)
|
|
291
|
-
- FREE: 1500 requests/day, no credit card required
|
|
292
|
-
- Resolution: up to 1024x1024
|
|
293
|
-
- Fast generation (~2-3 seconds)
|
|
294
|
-
- Best for: Quick iterations, development, testing
|
|
295
|
-
|
|
296
|
-
- **`gemini-2.0-flash-preview-image-generation`**
|
|
297
|
-
- FREE: 1500 requests/day
|
|
298
|
-
- Preview model with experimental features
|
|
299
|
-
|
|
300
|
-
### Vertex AI (Google Cloud) - Paid
|
|
301
|
-
- **`imagen-3.0-generate-002`** (Imagen 3)
|
|
302
|
-
- Pricing: ~$0.02-0.04/image
|
|
303
|
-
- Resolution: up to 1536x1536
|
|
304
|
-
- High quality, production-ready
|
|
305
|
-
|
|
306
|
-
- **`imagen-4`** (newest, highest quality)
|
|
307
|
-
- Pricing: ~$0.04/image
|
|
308
|
-
- Resolution: up to 2048x2048
|
|
309
|
-
- Best for: Professional work, final production images
|
|
310
|
-
|
|
311
|
-
### AWS Bedrock - Paid
|
|
312
|
-
- **`amazon.nova-canvas-v1:0`** (Nova Canvas)
|
|
313
|
-
- Resolution: up to 1408x1408
|
|
314
|
-
- Standard quality: 50 steps, $0.04/image
|
|
315
|
-
- Premium quality: 100 steps, $0.08/image
|
|
316
|
-
- Best for: AWS-integrated applications
|
|
317
|
-
|
|
318
|
-
**View all models with live pricing:**
|
|
319
|
-
```bash
|
|
320
|
-
gimage generate --list-models
|
|
321
|
-
# or
|
|
322
|
-
gimage auth list # Shows configured providers
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
## Image Formats Supported
|
|
326
|
-
|
|
327
|
-
**Input & Output**: PNG, JPEG, WebP, GIF, TIFF, BMP
|
|
328
|
-
|
|
329
|
-
All processing operations preserve format by default, or you can specify output format with `--output` flag or use the `convert` command.
|
|
330
|
-
|
|
331
|
-
## Advanced Features
|
|
332
|
-
|
|
333
|
-
### Styles (Generation)
|
|
334
|
-
- `photorealistic` - Realistic photos
|
|
335
|
-
- `artistic` - Artistic interpretations
|
|
336
|
-
- `anime` - Anime/manga style
|
|
337
|
-
|
|
338
|
-
### Quality Settings
|
|
339
|
-
- Compression quality: 1-100 (default: 90)
|
|
340
|
-
- Resampling: Lanczos algorithm (highest quality)
|
|
341
|
-
- Transparency: Preserved for PNG, white background for JPEG
|
|
342
|
-
|
|
343
|
-
### Batch Processing
|
|
344
|
-
- Default: 4 parallel workers
|
|
345
|
-
- Configurable with `--workers` flag
|
|
346
|
-
- Processes entire directories
|
|
347
|
-
- Preserves directory structure with `--output`
|
|
348
|
-
|
|
349
|
-
## Use Cases
|
|
350
|
-
|
|
351
|
-
### For Designers & Artists
|
|
352
|
-
- Rapid prototyping of visual concepts
|
|
353
|
-
- Generate variations of ideas
|
|
354
|
-
- Quick image editing and optimization
|
|
355
|
-
- Batch resize for different platforms
|
|
356
|
-
|
|
357
|
-
### For Developers
|
|
358
|
-
- Generate placeholder images for apps
|
|
359
|
-
- Automate image processing pipelines
|
|
360
|
-
- Integrate AI generation into workflows
|
|
361
|
-
- Test with reproducible images (seeds)
|
|
362
|
-
|
|
363
|
-
### For Content Creators
|
|
364
|
-
- Create social media graphics
|
|
365
|
-
- Generate blog post illustrations
|
|
366
|
-
- Batch optimize images for web
|
|
367
|
-
- Convert formats for different platforms
|
|
368
|
-
|
|
369
|
-
### For AI/ML Engineers
|
|
370
|
-
- Generate training data
|
|
371
|
-
- Create synthetic datasets
|
|
372
|
-
- Automate image augmentation
|
|
373
|
-
- Integrate with Claude via MCP server
|
|
374
|
-
|
|
375
|
-
## MCP Server for AI Assistants
|
|
376
|
-
|
|
377
|
-
Gimage can run as an MCP (Model Context Protocol) server, enabling AI assistants like Claude to generate and process images directly. The server communicates over stdio using the MCP protocol and exposes 10 tools for image generation and processing.
|
|
378
|
-
|
|
379
|
-
### Installation Methods
|
|
380
|
-
|
|
381
|
-
There are two ways to install gimage for use with Claude Desktop. Choose based on your use case:
|
|
382
|
-
|
|
383
|
-
#### Method 1: Homebrew (Recommended - macOS/Linux only)
|
|
384
|
-
|
|
385
|
-
**Use this if:** You want both CLI access AND MCP server functionality from a single installation.
|
|
386
|
-
|
|
387
|
-
**Step 1: Install gimage via Homebrew**
|
|
388
|
-
```bash
|
|
389
|
-
brew install apresai/tap/gimage
|
|
390
|
-
gimage --version # Verify installation
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
**Step 2: Configure Claude Desktop MCP**
|
|
394
|
-
|
|
395
|
-
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `~/.config/Claude/claude_desktop_config.json` (Linux):
|
|
396
|
-
|
|
397
|
-
```json
|
|
398
|
-
{
|
|
399
|
-
"mcpServers": {
|
|
400
|
-
"gimage": {
|
|
401
|
-
"command": "gimage",
|
|
402
|
-
"args": ["serve"]
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
**Why this method?**
|
|
409
|
-
- ✅ Single installation serves both CLI and MCP
|
|
410
|
-
- ✅ Easy updates: `brew upgrade apresai/tap/gimage`
|
|
411
|
-
- ✅ Directly calls the `gimage` binary in your PATH
|
|
412
|
-
- ✅ Smaller total footprint (one binary)
|
|
413
|
-
|
|
414
|
-
#### Method 2: npm Package (Cross-platform alternative)
|
|
415
|
-
|
|
416
|
-
**Use this if:** You're on Windows, don't use Homebrew, or only want MCP functionality (no CLI needed).
|
|
417
|
-
|
|
418
|
-
**Step 1: Install via npm**
|
|
419
|
-
```bash
|
|
420
|
-
npm install -g @apresai/gimage-mcp
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
**Step 2: Configure Claude Desktop MCP**
|
|
424
|
-
|
|
425
|
-
Edit your Claude Desktop config file:
|
|
426
|
-
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
427
|
-
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
428
|
-
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
429
|
-
|
|
430
|
-
```json
|
|
431
|
-
{
|
|
432
|
-
"mcpServers": {
|
|
433
|
-
"gimage": {
|
|
434
|
-
"command": "npx",
|
|
435
|
-
"args": ["-y", "@apresai/gimage-mcp"]
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
**Why this method?**
|
|
442
|
-
- ✅ Works on Windows (Homebrew method doesn't)
|
|
443
|
-
- ✅ npm-based workflow (familiar to Node.js users)
|
|
444
|
-
- ✅ `npx` automatically downloads/runs the correct version
|
|
445
|
-
- ⚠️ Note: npm installs gimage ONLY for MCP use (hidden in npm global directory)
|
|
446
|
-
- ⚠️ If you want CLI access too, you'll need to install via Homebrew separately
|
|
447
|
-
|
|
448
|
-
**Configuration difference explained:**
|
|
449
|
-
- **Homebrew**: Uses `"command": "gimage"` - directly calls the binary in your PATH
|
|
450
|
-
- **npm**: Uses `"command": "npx"` - npx finds and runs the npm-installed package
|
|
451
|
-
|
|
452
|
-
### Setup Authentication
|
|
453
|
-
|
|
454
|
-
Before using the MCP server, configure your API credentials:
|
|
455
|
-
|
|
456
|
-
```bash
|
|
457
|
-
# Quick start with Gemini (FREE tier)
|
|
458
|
-
gimage auth setup gemini
|
|
459
|
-
|
|
460
|
-
# Or use environment variable (more secure):
|
|
461
|
-
export GEMINI_API_KEY="your-api-key-here"
|
|
462
|
-
|
|
463
|
-
# Verify configuration
|
|
464
|
-
gimage auth status
|
|
465
|
-
gimage auth test gemini
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
The MCP server automatically uses credentials from:
|
|
469
|
-
1. **Environment variables** - `GEMINI_API_KEY`, `VERTEX_API_KEY`, `AWS_ACCESS_KEY_ID`, etc. (RECOMMENDED for security)
|
|
470
|
-
2. **Config file** - `~/.gimage/config.md` (created by `gimage auth setup` commands)
|
|
471
|
-
|
|
472
|
-
**Best Practice**: Use environment variables for production - they're more secure than storing credentials in config files.
|
|
473
|
-
|
|
474
|
-
### Start Using with Claude
|
|
475
|
-
|
|
476
|
-
After installation and authentication, restart Claude Desktop. You can then use natural language:
|
|
477
|
-
|
|
478
|
-
```
|
|
479
|
-
"Generate an image of a sunset over mountains"
|
|
480
|
-
"Resize photo.jpg to 800x600"
|
|
481
|
-
"Compress all images in the photos directory to 85% quality"
|
|
482
|
-
"Create a 2048x2048 photorealistic image of a wise old wizard"
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
### Available MCP Tools
|
|
486
|
-
|
|
487
|
-
The MCP server exposes 10 tools for AI assistants:
|
|
488
|
-
|
|
489
|
-
| Tool | Purpose |
|
|
490
|
-
|------|---------|
|
|
491
|
-
| `generate_image` | AI image generation from text |
|
|
492
|
-
| `resize_image` | Resize to specific dimensions |
|
|
493
|
-
| `scale_image` | Scale by factor (maintain aspect ratio) |
|
|
494
|
-
| `crop_image` | Crop to specific region |
|
|
495
|
-
| `compress_image` | Reduce file size with quality control |
|
|
496
|
-
| `convert_image` | Convert between formats |
|
|
497
|
-
| `batch_resize` | Resize multiple images concurrently |
|
|
498
|
-
| `batch_compress` | Compress multiple images |
|
|
499
|
-
| `batch_convert` | Convert multiple images to new format |
|
|
500
|
-
| `list_models` | List available AI models |
|
|
501
|
-
|
|
502
|
-
### Troubleshooting MCP Server
|
|
503
|
-
|
|
504
|
-
If the MCP server isn't working in Claude Desktop:
|
|
505
|
-
|
|
506
|
-
1. **Verify gimage is installed and in PATH:**
|
|
507
|
-
```bash
|
|
508
|
-
which gimage
|
|
509
|
-
gimage --version
|
|
510
|
-
```
|
|
511
|
-
|
|
512
|
-
2. **Test the serve command directly:**
|
|
513
|
-
```bash
|
|
514
|
-
gimage serve --verbose
|
|
515
|
-
```
|
|
516
|
-
This will show detailed logging to stderr. Press Ctrl+C to stop.
|
|
517
|
-
|
|
518
|
-
3. **Verify API credentials are configured:**
|
|
519
|
-
```bash
|
|
520
|
-
gimage auth status # Check all configured credentials
|
|
521
|
-
```
|
|
522
|
-
|
|
523
|
-
4. **Test image generation works outside MCP:**
|
|
524
|
-
```bash
|
|
525
|
-
gimage generate "test image"
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
5. **Check Claude Desktop logs** for error messages:
|
|
529
|
-
- **macOS**: `~/Library/Logs/Claude/`
|
|
530
|
-
- **Linux**: `~/.config/Claude/logs/`
|
|
531
|
-
|
|
532
|
-
6. **Ensure config file exists and has correct permissions:**
|
|
533
|
-
```bash
|
|
534
|
-
ls -la ~/.gimage/config.md
|
|
535
|
-
```
|
|
536
|
-
Should be readable (permissions: `-rw-------` or `-rw-r--r--`)
|
|
537
|
-
|
|
538
|
-
### Environment Variables
|
|
539
|
-
|
|
540
|
-
The MCP server respects the same environment variables as the CLI. See [Configuration](#configuration) for complete list of supported variables for all authentication modes (Gemini, Vertex AI, AWS Bedrock).
|
|
541
|
-
|
|
542
|
-
### MCP Documentation
|
|
543
|
-
|
|
544
|
-
For comprehensive guides and examples:
|
|
545
|
-
|
|
546
|
-
- **Usage Guide**: [docs/MCP_USAGE.md](docs/MCP_USAGE.md) - Complete setup and usage
|
|
547
|
-
- **Tool Reference**: [docs/MCP_TOOLS.md](docs/MCP_TOOLS.md) - Detailed tool documentation
|
|
548
|
-
- **Examples**: [docs/MCP_EXAMPLES.md](docs/MCP_EXAMPLES.md) - Real-world workflows
|
|
549
|
-
- **Implementation Plan**: [mcp.md](mcp.md) - Complete MCP architecture and implementation details
|
|
550
|
-
|
|
551
|
-
## Command Reference
|
|
552
|
-
|
|
553
|
-
See [COMMANDS.md](COMMANDS.md) for complete command reference and detailed usage examples.
|
|
554
|
-
|
|
555
|
-
**Available commands**:
|
|
556
|
-
- `generate` - AI image generation from text prompts
|
|
557
|
-
- `resize` - Resize images to specific dimensions
|
|
558
|
-
- `scale` - Scale images by a factor
|
|
559
|
-
- `crop` - Crop images to specific regions
|
|
560
|
-
- `compress` - Compress images to reduce file size (JPG, WebP)
|
|
561
|
-
- `convert` - Convert images between formats
|
|
562
|
-
- `auth` - Configure and manage API credentials (setup, status, list, test)
|
|
563
|
-
- `serve` - Start MCP server for Claude Desktop (includes batch operations)
|
|
564
|
-
- `tui` - Launch interactive terminal UI
|
|
565
|
-
|
|
566
|
-
**Removed commands** (use alternatives):
|
|
567
|
-
- `batch` - Use MCP server or shell scripts (see [Batch Processing](#batch-processing))
|
|
568
|
-
- `config` - Use `auth` commands for configuration
|
|
569
|
-
|
|
570
|
-
Run `gimage [command] --help` for detailed usage of any command.
|
|
571
|
-
|
|
572
|
-
---
|
|
573
|
-
|
|
574
|
-
## Go SDK
|
|
575
|
-
|
|
576
|
-
A type-safe Go SDK for programmatic API access.
|
|
577
|
-
|
|
578
|
-
**Repository**: [github.com/apresai/gimage-go-sdk](https://github.com/apresai/gimage-go-sdk)
|
|
579
|
-
|
|
580
|
-
### Installation
|
|
581
|
-
|
|
582
|
-
```bash
|
|
583
|
-
go get github.com/apresai/gimage-go-sdk@latest
|
|
584
|
-
```
|
|
585
|
-
|
|
586
|
-
### Quick Start
|
|
587
|
-
|
|
588
|
-
```go
|
|
589
|
-
import gimage "github.com/apresai/gimage-go-sdk"
|
|
590
|
-
|
|
591
|
-
// Create client with API key authentication
|
|
592
|
-
client, _ := gimage.NewClient(
|
|
593
|
-
"https://your-api.execute-api.us-east-1.amazonaws.com/production",
|
|
594
|
-
gimage.WithRequestEditorFn(func(ctx context.Context, req *http.Request) error {
|
|
595
|
-
req.Header.Set("x-api-key", "your-api-key")
|
|
596
|
-
return nil
|
|
597
|
-
}),
|
|
598
|
-
)
|
|
599
|
-
|
|
600
|
-
// Generate image
|
|
601
|
-
resp, _ := client.GenerateImage(ctx, gimage.GenerateImageJSONRequestBody{
|
|
602
|
-
Prompt: "sunset over mountains",
|
|
603
|
-
Model: stringPtr("gemini-2.5-flash-image"),
|
|
604
|
-
Size: stringPtr("1024x1024"),
|
|
605
|
-
})
|
|
606
|
-
```
|
|
607
|
-
|
|
608
|
-
### Features
|
|
609
|
-
|
|
610
|
-
- ✅ **Type-safe**: All types generated from OpenAPI spec
|
|
611
|
-
- ✅ **Auto-complete**: Full IDE support with godoc
|
|
612
|
-
- ✅ **API Gateway ready**: Built-in API key authentication support
|
|
613
|
-
- ✅ **Standard Go modules**: Independent versioning with semantic versioning
|
|
614
|
-
|
|
615
|
-
### Documentation
|
|
616
|
-
|
|
617
|
-
Complete documentation, examples, and API reference:
|
|
618
|
-
- **SDK Repository**: [github.com/apresai/gimage-go-sdk](https://github.com/apresai/gimage-go-sdk)
|
|
619
|
-
- **GoDoc**: [pkg.go.dev/github.com/apresai/gimage-go-sdk](https://pkg.go.dev/github.com/apresai/gimage-go-sdk)
|
|
620
|
-
- **Examples**: See the SDK repository for working examples
|
|
621
|
-
|
|
622
|
-
---
|
|
623
|
-
|
|
624
|
-
## Lambda API Distribution
|
|
625
|
-
|
|
626
|
-
Deploy Gimage as a serverless REST API on AWS Lambda for web application integration.
|
|
627
|
-
|
|
628
|
-
### Features
|
|
629
|
-
|
|
630
|
-
- **Serverless Architecture**: AWS Lambda on ARM64/Graviton2 (provided.al2023 runtime)
|
|
631
|
-
- **Auto-Scaling**: Handles 0 to thousands of requests automatically
|
|
632
|
-
- **Cost-Effective**: Pay only for what you use (~$0.25/month for 10K requests)
|
|
633
|
-
- **S3 Storage**: Automatic S3 bucket for image storage with presigned URLs
|
|
634
|
-
- **Production-Ready**: Full CORS, error handling, monitoring
|
|
635
|
-
- **API Gateway Integration**: Managed API keys, usage plans, rate limiting
|
|
636
|
-
|
|
637
|
-
### Quick Deploy
|
|
638
|
-
|
|
639
|
-
**Option 1: Using gimage-deploy tool (Recommended)**
|
|
640
|
-
|
|
641
|
-
```bash
|
|
642
|
-
# Build Lambda function
|
|
643
|
-
make build-lambda
|
|
644
|
-
make package-lambda
|
|
645
|
-
|
|
646
|
-
# Deploy using gimage-deploy (from sibling directory)
|
|
647
|
-
cd ../gimage-deploy
|
|
648
|
-
./bin/gimage-deploy deploy \
|
|
649
|
-
--id production \
|
|
650
|
-
--stage production \
|
|
651
|
-
--region us-east-1 \
|
|
652
|
-
--lambda-code ../gimage/bin/lambda.zip \
|
|
653
|
-
--memory 512 \
|
|
654
|
-
--timeout 30
|
|
655
|
-
|
|
656
|
-
# Create API key
|
|
657
|
-
./bin/gimage-deploy keys create --name prod-key --deployment production
|
|
658
|
-
```
|
|
659
|
-
|
|
660
|
-
**Option 2: Manual deployment**
|
|
661
|
-
|
|
662
|
-
See [lambda.md](lambda.md) for manual deployment guide with AWS CLI.
|
|
663
|
-
|
|
664
|
-
### Deployment Tool
|
|
665
|
-
|
|
666
|
-
The `gimage-deploy` CLI tool (separate project) provides complete deployment management:
|
|
667
|
-
- One-command deployment to AWS Lambda
|
|
668
|
-
- API Gateway configuration with API keys
|
|
669
|
-
- Monitoring (logs, metrics, health checks)
|
|
670
|
-
- Interactive TUI for management
|
|
671
|
-
- No hardcoded account IDs - works in any AWS account
|
|
672
|
-
|
|
673
|
-
See the `gimage-deploy` directory for the deployment management tool.
|
|
674
|
-
|
|
675
|
-
### API Endpoints
|
|
676
|
-
|
|
677
|
-
All operations available via REST API:
|
|
678
|
-
|
|
679
|
-
| Endpoint | Method | Purpose |
|
|
680
|
-
|----------|--------|---------|
|
|
681
|
-
| `/generate` | POST | AI image generation |
|
|
682
|
-
| `/resize` | POST | Resize to dimensions |
|
|
683
|
-
| `/scale` | POST | Scale by factor |
|
|
684
|
-
| `/crop` | POST | Crop region |
|
|
685
|
-
| `/compress` | POST | Compress with quality |
|
|
686
|
-
| `/convert` | POST | Convert format |
|
|
687
|
-
| `/batch` | POST | Process multiple images |
|
|
688
|
-
| `/health` | GET | Health check |
|
|
689
|
-
| `/docs` | GET | **Interactive Swagger UI documentation** |
|
|
690
|
-
| `/openapi.yaml` | GET | OpenAPI specification |
|
|
691
|
-
|
|
692
|
-
**Try the API**: After deployment, visit `https://your-api-url/prod/docs` for interactive documentation!
|
|
693
|
-
|
|
694
|
-
### Integration Examples
|
|
695
|
-
|
|
696
|
-
**TypeScript/JavaScript:**
|
|
697
|
-
```typescript
|
|
698
|
-
const response = await fetch('https://your-api-url/generate', {
|
|
699
|
-
method: 'POST',
|
|
700
|
-
headers: { 'Content-Type': 'application/json' },
|
|
701
|
-
body: JSON.stringify({
|
|
702
|
-
prompt: 'a sunset over mountains',
|
|
703
|
-
size: '1024x1024',
|
|
704
|
-
response_format: 's3_url'
|
|
705
|
-
})
|
|
706
|
-
});
|
|
707
|
-
|
|
708
|
-
const result = await response.json();
|
|
709
|
-
console.log('Image URL:', result.s3_url);
|
|
710
|
-
```
|
|
711
|
-
|
|
712
|
-
**Python:**
|
|
713
|
-
```python
|
|
714
|
-
import requests
|
|
715
|
-
|
|
716
|
-
response = requests.post('https://your-api-url/resize', json={
|
|
717
|
-
'image': base64_image,
|
|
718
|
-
'width': 800,
|
|
719
|
-
'height': 600
|
|
720
|
-
})
|
|
721
|
-
|
|
722
|
-
result = response.json()
|
|
723
|
-
print(f"Resized: {result['width']}x{result['height']}")
|
|
724
|
-
```
|
|
725
|
-
|
|
726
|
-
**Go:**
|
|
727
|
-
```go
|
|
728
|
-
client := gimage.NewClient("https://your-api-url", apiKey)
|
|
729
|
-
result, err := client.GenerateImage(gimage.GenerateRequest{
|
|
730
|
-
Prompt: "beautiful landscape",
|
|
731
|
-
Size: "1024x1024",
|
|
732
|
-
})
|
|
733
|
-
```
|
|
734
|
-
|
|
735
|
-
### Documentation
|
|
736
|
-
|
|
737
|
-
- **Deployment Guide**: [lambda.md](lambda.md) - Complete deployment and infrastructure setup
|
|
738
|
-
- **Integration Guide**: [INTEGRATION_GUIDE.md](INTEGRATION_GUIDE.md) - Client SDKs & examples
|
|
739
|
-
- **OpenAPI Spec**: [openapi.yaml](openapi.yaml) - Complete API reference
|
|
740
|
-
|
|
741
|
-
### Architecture
|
|
742
|
-
|
|
743
|
-
```
|
|
744
|
-
Client Request → API Gateway → Lambda (Go/ARM64) → {S3, Gemini, Vertex AI}
|
|
745
|
-
↓
|
|
746
|
-
Small: base64 response
|
|
747
|
-
Large: S3 presigned URL
|
|
748
|
-
```
|
|
749
|
-
|
|
750
|
-
**Runtime**: AWS Lambda provided.al2023 (Amazon Linux 2023)
|
|
751
|
-
**Architecture**: ARM64 (Graviton2 processors)
|
|
752
|
-
**Package Size**: 17MB compressed, 42MB uncompressed
|
|
753
|
-
**Memory**: 2GB (configurable)
|
|
754
|
-
**Timeout**: 5 minutes max
|
|
755
|
-
|
|
756
|
-
---
|
|
757
|
-
|
|
758
|
-
## Building from Source
|
|
759
|
-
|
|
760
|
-
### CLI Binary
|
|
761
|
-
|
|
762
|
-
```bash
|
|
763
|
-
git clone https://github.com/apresai/gimage.git
|
|
764
|
-
cd gimage
|
|
765
|
-
make build
|
|
766
|
-
./bin/gimage --version
|
|
767
|
-
```
|
|
768
|
-
|
|
769
|
-
### Lambda Function
|
|
770
|
-
|
|
771
|
-
```bash
|
|
772
|
-
# Build for AWS Lambda ARM64
|
|
773
|
-
make build-lambda
|
|
774
|
-
|
|
775
|
-
# Package as deployment zip
|
|
776
|
-
make package-lambda
|
|
777
|
-
|
|
778
|
-
# Output: bin/lambda.zip (17MB)
|
|
779
|
-
```
|
|
780
|
-
|
|
781
|
-
## Requirements
|
|
782
|
-
|
|
783
|
-
### CLI
|
|
784
|
-
- **None!** Single static binary with zero dependencies
|
|
785
|
-
- Works on: macOS, Linux, Windows (x86_64, ARM64)
|
|
786
|
-
- No Python, no Node.js, no system libraries required
|
|
787
|
-
|
|
788
|
-
### Lambda API
|
|
789
|
-
- AWS Account
|
|
790
|
-
- AWS CLI configured
|
|
791
|
-
- Node.js 20+ (for CDK deployment)
|
|
792
|
-
- Go 1.22+ (for building)
|
|
793
|
-
|
|
794
|
-
## Support & Documentation
|
|
795
|
-
|
|
796
|
-
### CLI
|
|
797
|
-
- **Full Command Reference**: [COMMANDS.md](COMMANDS.md)
|
|
798
|
-
- **Configuration Guide**: See `gimage auth --help`
|
|
799
|
-
|
|
800
|
-
### Lambda API
|
|
801
|
-
- **OpenAPI Specification**: [openapi.yaml](openapi.yaml)
|
|
802
|
-
- **Integration Guide**: [INTEGRATION_GUIDE.md](INTEGRATION_GUIDE.md)
|
|
803
|
-
- **Deployment Guide**: [lambda.md](lambda.md)
|
|
804
|
-
- **Implementation Status**: [LAMBDA_STATUS.md](LAMBDA_STATUS.md)
|
|
805
|
-
|
|
806
|
-
### Community
|
|
807
|
-
- **GitHub Issues**: https://github.com/apresai/gimage/issues
|
|
808
|
-
- **Discussions**: https://github.com/apresai/gimage/discussions
|
|
809
|
-
|
|
810
|
-
## License
|
|
811
|
-
|
|
812
|
-
MIT License - see [LICENSE](LICENSE) file for details.
|
|
813
|
-
|
|
814
|
-
## Credits
|
|
815
|
-
|
|
816
|
-
Built with:
|
|
817
|
-
- [Cobra](https://github.com/spf13/cobra) - CLI framework
|
|
818
|
-
- [Imaging](https://github.com/disintegration/imaging) - Image processing
|
|
819
|
-
- [Google Gen AI SDK](https://github.com/googleapis/go-genai) - Gemini API
|
|
820
|
-
- [Vertex AI SDK](https://cloud.google.com/go/vertexai) - Vertex AI
|
|
821
|
-
- [AWS SDK for Go](https://github.com/aws/aws-sdk-go-v2) - AWS Bedrock
|
|
822
|
-
|
|
823
|
-
---
|
|
824
|
-
|
|
825
|
-
**Made with ❤️ for developers, designers, and AI enthusiasts**
|
package/bin/gimage
DELETED
|
Binary file
|
package/bin/gimage-deploy
DELETED
|
Binary file
|