Carbon Code Image Generator
FastAPI service that generates beautiful code images using Carbon.now.sh with customizable styling and JPG output.
GitHub: 0xarchit/carbon-now-sh-api
Live Demo: https://zeroxcarbon.onrender.com/docs
Tip
A FastAPI service that generates beautiful code images using Carbon.now.sh. Convert your code into shareable JPG images with customizable styling.
Features
- Generate high-quality code images in JPG format
- Pre-configured with Seti theme and Hack font
- Optimized for JPG output
- Fast API with CORS support
- Clean, minimal design without watermarks
Installation & Usage
1. Build the Docker image:
docker build -t carbon-api .
2. Run the container:
docker run -p 8000:8000 carbon-api
3. Generate code image:
GET /generate-image?code=YOUR_CODE_HERE
Example
curl "http://localhost:8000/generate-image?code=console.log('Hello World');"
Returns a JPG image of your formatted code.
API Endpoints
Configuration
The service uses these Carbon.now.sh settings:
- Theme: Seti
- Font: Hack (12px)
- Format: JPG (90% quality)
- Size: 512x512 pixels
- No line numbers, window controls, or watermarks
Live Demo
Try it now: https://zeroxcarbon.onrender.com/docs
Interactive API documentation with live testing capabilities.
Deployment
Ready for deployment on any Docker-compatible platform including:
- AWS (Elastic Container Service)
- Google Cloud (Cloud Run)
- Azure (Container Instances)
- Render (Container Service)