[2.8.3] Fix gemini-imagegen file format documentation
- Add critical documentation about Gemini returning JPEG by default - Explain that using .jpg extension avoids "Image does not match media type" errors - Provide PNG conversion example when needed - Include format verification command 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "compounding-engineering",
|
||||
"version": "2.8.2",
|
||||
"version": "2.8.3",
|
||||
"description": "AI-powered development tools. 24 agents, 16 commands, 11 skills, 2 MCP servers for code review, research, design, and workflow automation.",
|
||||
"author": {
|
||||
"name": "Kieran Klaassen",
|
||||
|
||||
@@ -5,6 +5,12 @@ All notable changes to the compounding-engineering plugin will be documented in
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2.8.3] - 2025-11-29
|
||||
|
||||
### Fixed
|
||||
|
||||
- **`gemini-imagegen` skill** - Added critical documentation about file format handling. Gemini returns JPEG by default, so using `.jpg` extension is required to avoid "Image does not match media type" API errors. Added examples for PNG conversion when needed and format verification.
|
||||
|
||||
## [2.8.2] - 2025-11-28
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -192,9 +192,46 @@ response = client.models.generate_content(
|
||||
)
|
||||
```
|
||||
|
||||
## Important: File Format & Media Type
|
||||
|
||||
**CRITICAL:** The Gemini API returns images in JPEG format by default. When saving, always use `.jpg` extension to avoid media type mismatches.
|
||||
|
||||
```python
|
||||
# CORRECT - Use .jpg extension (Gemini returns JPEG)
|
||||
image.save("output.jpg")
|
||||
|
||||
# WRONG - Will cause "Image does not match media type" errors
|
||||
image.save("output.png") # Creates JPEG with PNG extension!
|
||||
```
|
||||
|
||||
### Converting to PNG (if needed)
|
||||
|
||||
If you specifically need PNG format:
|
||||
|
||||
```python
|
||||
from PIL import Image
|
||||
|
||||
# Generate with Gemini
|
||||
for part in response.parts:
|
||||
if part.inline_data:
|
||||
img = part.as_image()
|
||||
# Convert to PNG by saving with explicit format
|
||||
img.save("output.png", format="PNG")
|
||||
```
|
||||
|
||||
### Verifying Image Format
|
||||
|
||||
Check actual format vs extension with the `file` command:
|
||||
|
||||
```bash
|
||||
file image.png
|
||||
# If output shows "JPEG image data" - rename to .jpg!
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- All generated images include SynthID watermarks
|
||||
- Gemini returns **JPEG format by default** - always use `.jpg` extension
|
||||
- Image-only mode (`responseModalities: ["IMAGE"]`) won't work with Google Search grounding
|
||||
- For editing, describe changes conversationally—the model understands semantic masking
|
||||
- Default to 1K resolution for speed; use 2K/4K when quality is critical
|
||||
|
||||
Reference in New Issue
Block a user