API Documentation

Clean, descriptive, and developer-friendly image generation API

Basic Usage

Generate placeholder images with our clean, descriptive API. All parameters are clearly labeled and optional.

Endpoint
GET /generate
Required Parameters
  • width - Image width in pixels
  • height - Image height in pixels
Optional Parameters
  • bg - Background color (hex without #)
  • color - Text color (hex without #)
  • text - Custom text to display
  • format - Output format (png, jpg, webp)
  • transparent - Transparent background (true/false)

Examples

Basic Image
/generate?width=800&height=600 Basic
Custom Colors
/generate?width=800&height=600&bg=4A90E2&color=FFFFFF Custom Colors
Custom Text
/generate?width=800&height=600&text=Hello+World Custom Text
Transparent Background
/generate?width=800&height=600&transparent=true&color=333333
Transparent
JPEG Format
/generate?width=800&height=600&format=jpg JPEG
WebP Format
/generate?width=800&height=600&format=webp WebP

Advanced Parameters

Parameter Description Default Example
font Font family Arial font=Arial
font_size Font size in pixels Auto-calculated font_size=24
align Text alignment (left, center, right) center align=center
valign Vertical alignment (top, middle, bottom) middle valign=middle
pattern Background pattern solid pattern=stripes
border Border width in pixels None border=2
border_color Border color (hex without #) 000000 border_color=FF0000
radius Corner radius in pixels None radius=10
shadow Shadow effect None shadow=5,5,10,000000
watermark Watermark text None watermark=Imgrly

Code Examples

HTML
<img src="/generate?width=800&height=600&bg=4A90E2&color=FFFFFF&text=Hero+Image" alt="Hero">
CSS Background
.hero {
  background-image: url('/generate?width=1920&height=1080&bg=4A90E2&color=FFFFFF');
}
JavaScript
const img = new Image();
img.src = `/generate?width=${width}&height=${height}&bg=${bgColor}&color=${textColor}`;
PHP
$url = "https://imgrly.com/generate?width=800&height=600&bg=4A90E2&color=FFFFFF";
$image = file_get_contents($url);

Response Headers

All responses include proper caching and content type headers for optimal performance.

Header Value Description
Content-Type image/png, image/jpeg, image/webp Based on format parameter
Cache-Control public, max-age=31536000 Cache for 1 year
Content-Length 12345 Size of generated image

Error Handling

Status Code Error Description
400 Missing required parameters Width and height are required
400 Invalid dimensions Dimensions must be positive numbers
400 Dimensions too large Maximum allowed: 5000x5000
500 Image generation failed Server error during image creation

Legacy API Support

We maintain backward compatibility with the old URL format, but we recommend using the new clean API.

Deprecated: The old URL format will be removed in a future version.
Old Format (Deprecated)
/placeholder/800x600/4A90E2/FFFFFF?text=Hello+World
New Format (Recommended)
/generate?width=800&height=600&bg=4A90E2&color=FFFFFF&text=Hello+World

© 2025 - IMGrly - All Rights Reserved by