Transform your code snippets into beautiful, shareable images with syntax highlighting
| Main Interface | Theme Selection |
|---|---|
![]() |
![]() |
| Full editor with code preview | 10 beautiful syntax themes |
| Mobile Responsive | Export Preview |
|---|---|
![]() |
![]() |
| Works perfectly on mobile | High-res PNG export |
- Export code snippets as high-resolution PNG images (3x scale)
- Perfect for social media, documentation, and presentations
- 10 Professional Fonts: JetBrains Mono, Fira Code, Source Code Pro, and more
- 10 Syntax Themes: Dracula, Nord, Night Owl, VS Code Dark+, Synthwave '84, etc.
- 10 Canvas Presets: Beautiful gradient backgrounds
- Custom Colors: Pick any background and shadow color
- Adjustable Controls: Font size, padding, and shadow depth sliders
- JavaScript / TypeScript
- Python
- Rust / Go / C++
- Java / Kotlin / Swift
- PHP / SQL
- HTML / CSS
- Installable: Add to home screen on any device
- Offline Support: Works without internet connection
- Fast Loading: Assets cached for instant access
- Responsive Design: Works on mobile, tablet, and desktop
code-to-image-generator/
βββ π index.html # Main application (all-in-one HTML/CSS/JS)
βββ π manifest.json # PWA manifest
βββ π sw.js # Service Worker for offline support
βββ π README.md # Documentation
βββ π screenshots/ # App screenshots folder
βββ main-interface.png
βββ themes.png
βββ mobile-view.png
βββ export-preview.png
βββ demo.gif
Simply open index.html in any modern web browser.
# Using Python 3
python -m http.server 8080
# Using Node.js (npx)
npx serve .
# Using PHP
php -S localhost:8080Then open http://localhost:8080 in your browser.
- Select Language: Choose your programming language from the dropdown
- Paste Code: Enter or paste your code in the textarea
- Customize: Adjust font, theme, colors, padding, and shadow
- Preview: Click "Refresh Preview" to see changes
- Export: Click "Export PNG" to download the image
| Technology | Description |
|---|---|
| Utility-first CSS framework | |
| Syntax highlighting library | |
| Screenshot library | |
| Progressive Web App |
| Browser | Version | Status |
|---|---|---|
| 80+ | β Supported | |
| 75+ | β Supported | |
| 13+ | β Supported | |
| 80+ | β Supported |
- Open the app in Chrome
- Click the install icon in the address bar
- Click "Install"
- Open the app in Chrome
- Tap the three-dot menu
- Select "Add to Home Screen"
- Open the app in Safari
- Tap the share button
- Select "Add to Home Screen"
| Feature | Description | Status |
|---|---|---|
| π€ 10 Fonts | Professional monospace fonts | β |
| π¨ 10 Themes | Popular syntax highlighting themes | β |
| π 10 Presets | Gradient background presets | β |
| π· PNG Export | High-res 3x scale images | β |
| π Copy Code | One-click code copying | β |
| π± PWA | Installable & offline ready | β |
| π Responsive | Mobile-first design | β |
| β‘ Fast | Cached for instant loading | β |
mkdir screenshots- Main Interface - Full app with code preview
- Themes - Show theme dropdown with different themes
- Mobile View - Use browser's responsive mode (F12 β Toggle device)
- Export Preview - Show the exported PNG result
Save as PNG files:
screenshots/main-interface.pngscreenshots/themes.pngscreenshots/mobile-view.pngscreenshots/export-preview.png
Use tools like:
- ScreenToGif (Windows)
- Gifski (Mac)
- Peek (Linux)
π code-to-image-generator/
βββ index.html
βββ manifest.json
βββ sw.js
βββ README.md
βββ π screenshots/
βββ main-interface.png
βββ themes.png
βββ mobile-view.png
βββ export-preview.png
- Go to https://github.com/new
- Repository name:
code-to-image-generator - Description:
π¨ Transform code snippets into beautiful images - PWA - β Select Public
- β Add a README file - UNCHECK this (because we already have a README)
- Click Create repository
-
On the repository page, click "Add file" β "Upload files"
-
Drag and drop all files:
index.htmlmanifest.jsonsw.jsREADME.md
-
Click "Commit changes"
-
For the screenshots folder:
- Click "Add file" β "Create new file" again
- In the name field, type:
screenshots/.gitkeep - Click "Commit changes"
- Now click "Add file" β "Upload files" to upload your screenshots
# 1. Clone the repository
git clone https://github.com/SudhirDevOps1/code-to-image-generator.git
# 2. Navigate to the folder
cd code-to-image-generator
# 3. Copy all files to the folder
# (index.html, manifest.json, sw.js, README.md, screenshots/)
# 4. Add files to Git
git add .
# 5. Commit the changes
git commit -m "π Initial commit - Code to Image Generator PWA"
# 6. Push to GitHub
git push origin main- Go to the Settings tab in your repository
- Click Pages in the left sidebar
- In the Source section:
- Branch:
main - Folder:
/ (root)
- Branch:
- Click Save
- Wait 2-3 minutes for deployment
https://sudhirdevops1.github.io/code-to-image-generator/
- Click on the file you want to edit
- Click the pencil icon (Edit)
- Make your changes
- Click "Commit changes"
# Make changes to your files, then:
git add .
git commit -m "Updated feature XYZ"
git push origin mainPurchase from providers like:
Add these records in your domain provider:
Type: A
Name: @
Value: 185.199.108.153
Type: A
Name: @
Value: 185.199.109.153
Type: A
Name: @
Value: 185.199.110.153
Type: A
Name: @
Value: 185.199.111.153
Type: CNAME
Name: www
Value: sudhirdevops1.github.io
- Go to Settings β Pages
- Under "Custom domain", enter your domain
- Check "Enforce HTTPS"
- Click Save
- Check file names match exactly (case-sensitive)
- Ensure screenshots are in
screenshots/folder - Use relative paths:
screenshots/main-interface.png
- Wait 2-3 minutes for deployment
- Check
index.htmlis in root folder - Verify Pages is enabled in Settings
- Serve over HTTPS (GitHub Pages provides this)
- Check
manifest.jsonis valid - Check
sw.jsis in root folder
- Clear browser cache
- Unregister old service workers in DevTools β Application β Service Workers
- Hard refresh with Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)
- Check internet connection (fonts load from Google Fonts CDN)
- Some corporate networks block external resources
- Open DevTools (F12)
- Go to Application tab
- Check:
- Manifest - Should show app info
- Service Workers - Should be registered
- Cache Storage - Should show cached files
- Open DevTools (F12)
- Go to Lighthouse tab
- Check "Progressive Web App"
- Click "Analyze page load"
- Aim for 100% PWA score
Before sharing your project, verify:
- All 4 files are uploaded (index.html, manifest.json, sw.js, README.md)
- Screenshots folder with images is uploaded
- GitHub Pages is enabled
- Website loads correctly
- PWA install button works
- Export PNG works
- All themes load correctly
- Mobile view is responsive
MIT License - feel free to use this project for personal or commercial purposes.
MIT License
Copyright (c) 2024 Sudhir Kumar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- Fonts from Google Fonts
- Prism themes from Prism Themes
- Icons and styling inspired by modern code editors
- html2canvas by Niklas von Hertzen
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a new branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Have an idea for a new feature? Open an issue with the tag enhancement and describe:
- What feature you'd like to see
- Why it would be useful
- Any implementation ideas you have
Made with β€οΈ by Sudhir Kumar for developers who love beautiful code snippets!




