@@ -20,8 +20,12 @@ All generated images must meet GitHub's social preview requirements:
2020- ** Minimum** : 640x320 pixels
2121- ** Recommended** : 1280x640 pixels (2:1 aspect ratio)
2222- ** Maximum file size** : 1MB
23- - ** Formats** : SVG (default), PNG, JPG, GIF
24- - ** Default output** : ` .github/social-preview.svg `
23+ - ** Formats** : JPG (required for GitHub), SVG (source file)
24+ - ** Default outputs** :
25+ - ` .github/social-preview.svg ` - Editable source file
26+ - ` .github/social-preview.jpg ` - ** Always generated** for GitHub upload
27+
28+ ** IMPORTANT** : GitHub's social preview setting requires a raster image (JPG/PNG). SVG generation MUST ALWAYS also produce a JPG file.
2529
2630## Workflow
2731
@@ -180,10 +184,22 @@ If `dark_mode: true` or `dark_mode: both`:
180184- Adjust accent colors for dark backgrounds
181185- If ` both ` : save as ` [name].svg ` and ` [name]-dark.svg `
182186
183- ** Save SVG** :
187+ ** Save SVG and Convert to JPG ** :
1841881 . Write SVG content to ` output_path ` (default: ` .github/social-preview.svg ` )
185- 2 . Verify file size < 50KB (warn if larger)
186- 3 . If ` dark_mode: both ` , generate and save dark variant
189+ 2 . Verify SVG file size < 50KB (warn if larger)
190+ 3 . ** MANDATORY: Convert SVG to JPG** :
191+ ``` bash
192+ # Convert SVG to JPG at 1280x640, quality 90
193+ convert .github/social-preview.svg -resize 1280x640! -quality 90 -background white -flatten .github/social-preview.jpg
194+ ```
195+ 4 . Verify JPG meets requirements:
196+ - Dimensions: 1280x640
197+ - File size: < 1MB (compress if needed)
198+ 5 . If ` dark_mode: both ` , generate dark variant SVG and JPG:
199+ - ` .github/social-preview-dark.svg `
200+ - ` .github/social-preview-dark.jpg `
201+
202+ ** Note** : The JPG is the file to upload to GitHub's social preview setting. The SVG is kept as an editable source.
187203
188204---
189205
@@ -286,21 +302,26 @@ Negative prompt: text, watermarks, realistic photos, cluttered, busy patterns
286302
287303### Step 5: Verify Output
288304
289- ** For SVG output** :
305+ ** For SVG output** (always accompanied by JPG) :
2903061 . Verify valid XML structure
291- 2 . Check file size < 50KB (warn if 50-100KB, error if >100KB)
307+ 2 . Check SVG file size < 50KB (warn if 50-100KB, error if >100KB)
2923083 . Verify viewBox is 1280x640
309+ 4 . ** Verify JPG was created** :
310+ - File exists at ` .github/social-preview.jpg `
311+ - Dimensions are exactly 1280x640
312+ - File size is under 1MB
313+ - If exceeds 1MB, recompress with lower quality
293314
294- ** For image output (PNG/JPG)** :
315+ ** For AI-generated image output (PNG/JPG from DALL-E/Gemini )** :
2953161 . Verify file exists at output path
296- 2 . Check dimensions meet requirements (≥640x320)
317+ 2 . Check dimensions meet requirements (≥640x320, recommended 1280x640 )
2973183 . Check file size is under 1MB
2983194 . If exceeds 1MB, compress progressively
299320
300321** Report success with** :
301- - File location
302- - File size
303- - Dimensions
322+ - SVG file location and size
323+ - ** JPG file location and size** (for GitHub upload)
324+ - Dimensions (1280x640)
304325- Provider used
305326
306327### Step 6: Upload to Repository (Optional)
@@ -311,34 +332,45 @@ If `upload_to_repo: true` is configured (or `--upload` flag provided):
311332 - Parse ` git remote get-url origin ` to extract owner and repo name
312333 - Determine current branch with ` git branch --show-current `
313334
314- 2 . ** Prepare upload** :
315- - Read the generated file
335+ 2 . ** Prepare upload** (upload BOTH files) :
336+ - Read the SVG source file and JPG output file
316337 - Encode content as base64 for GitHub API
317338
318- 3 . ** Check for existing file ** :
319- - Use GitHub API to check if output file exists
320- - If exists , retrieve the SHA for update operation
339+ 3 . ** Check for existing files ** :
340+ - Use GitHub API to check if files exist
341+ - If exist , retrieve the SHA for update operation
321342
322- 4 . ** Upload via GitHub MCP tool** :
323- Use ` mcp__github__create_or_update_file ` with:
343+ 4 . ** Upload via GitHub MCP tool** (both SVG and JPG):
324344 ``` yaml
345+ # Upload JPG (for GitHub social preview)
325346 owner : [detected owner]
326347 repo : [detected repo]
327- path : [output_path]
328- content : [base64 encoded content ]
348+ path : .github/social-preview.jpg
349+ content : [base64 encoded JPG ]
329350 message : " chore: update social preview image"
330351 branch : [current or default branch]
331352 sha : [existing file SHA if updating]
332353 ` ` `
354+ ` ` ` yaml
355+ # Upload SVG (editable source)
356+ owner : [detected owner]
357+ repo : [detected repo]
358+ path : .github/social-preview.svg
359+ content : [base64 encoded SVG]
360+ message : " chore: update social preview source SVG"
361+ branch : [current or default branch]
362+ sha : [existing file SHA if updating]
363+ ` ` `
333364
3343655. **Report upload status**:
335- - Confirm successful upload with commit URL
366+ - Confirm successful upload with commit URLs
367+ - **Remind user**: The JPG file is what should be selected in GitHub settings
336368 - Provide GitHub settings link for activating the social preview
337369
338370**Note**: To set as actual social preview, users must:
3393711. Go to repository Settings → General
3403722. Scroll to "Social preview"
341- 3. Click "Edit" and select the uploaded image
373+ 3. Click "Edit" and select the **JPG** image ( ` .github/social-preview.jpg`)
342374
343375# # Color Palettes by Domain
344376
0 commit comments