๐งช Try It Out
Test the API endpoints directly from this page
Result:
Generate Image (Query Parameters)
GET
POST
/api/generate-image
Query Parameters / POST Body:
width
(number, 100-5120)
Image width in pixels
height
(number, 100-2880)
Image height in pixels
pattern
(string)
Pattern type: geometric, gradient, noise, abstract (default: geometric)
seed
(number, optional)
Random seed for deterministic generation
thumbnail
(boolean)
Return thumbnail instead of original (default: false)
random
(boolean)
Generate random dimensions (default: false)
Examples:
GET /api/generate-image
GET /api/generate-image?width=1024&height=768
GET /api/generate-image?width=800&height=600&pattern=gradient&seed=12345
GET /api/generate-image?random=true&pattern=noise
Generate Image (Filename-based)
GET
/api/image/{filename}
Filename Formats:
Format 1: Underscore-separated
h_{height}_w_{width}_s{seed}_p{pattern}.png
Format 2: X-separated
{width}x{height}x{seed}x{pattern}.png
Simple dimensions
{width}x{height}.png
Examples:
GET /api/image/800x600.png
GET /api/image/1024x768x12345.png
GET /api/image/600x400xgeometric.png
GET /api/image/1024x768x12345xgradient.png
GET /api/image/h_768_w_1024_s12345_pgradient.png
Response
Content-Type: image/png
Returns a PNG image file that can be used directly in HTML, downloaded, or uploaded in tests.
Usage in HTML:
<img src="/api/generate-image?width=800&height=600&seed=123" />
<img src="/api/image/800x600x123.png" />
Usage in k6 Tests:
import http from 'k6/http';
export default function () {
const imageUrl = 'https://your-site.com/api/image/1024x768x12345.png';
const imageData = http.get(imageUrl).body;
const formData = {
file: http.file(imageData, 'test.png', 'image/png')
};
http.post('https://api.example.com/upload', formData);
}
Pattern Types
geometric
Random shapes (rectangles, circles, triangles)
gradient
Linear gradient with random colors
noise
Random pixel noise pattern
abstract
Random curves and lines