A web-based image format converter built with Express and Sharp, deployed on Netlify as serverless functions.
- Node.js >= 18.14.0
- npm
- Netlify CLI
├── netlify/
│ └── functions/
│ └── api.js # Express serverless function
├── public/
│ ├── index.html # Frontend
│ └── assets/ # Static assets
├── netlify.toml # Netlify configuration
└── package.json
git clone https://github.com/your-username/image-converter.git
cd image-converternpm installnpm install netlify-cli -gnpm run devThe app will be available at: http://localhost:8888
POST /api/convert?format=<target_format>
Content-Type: multipart/form-data
Body: image (file)
POST /api/convert-download?format=<target_format>
Content-Type: multipart/form-data
Body: image (file)
| Format | Value |
|---|---|
| JPEG | jpeg or jpg |
| PNG | png |
| WebP | webp |
| AVIF | avif |
| TIFF | tiff |
| GIF | gif |
# Convert to WebP (returns JSON with base64)
curl -X POST "http://localhost:8888/api/convert?format=webp" \
-F "image=@/path/to/your/image.png"
# Convert and download directly
curl -X POST "http://localhost:8888/api/convert-download?format=webp" \
-F "image=@/path/to/your/image.png" \
--output converted.webp{
"message": "Gambar berhasil dikonversi ke webp!",
"originalName": "photo.png",
"convertedName": "photo.webp",
"dataUrl": "data:image/webp;base64,...",
"mimeType": "image/webp"
}- Push the project to GitHub/GitLab
- Go to netlify.com and import your repository
- Build settings are auto-detected from
netlify.toml - Click Deploy
netlify init- Maximum file size is subject to Netlify's serverless function payload limit (6MB by default)
sharpuses native binaries — if the deploy fails, add this topackage.json:
"optionalDependencies": {
"@img/sharp-linux-x64": "*"
}