### Applying Dynamic Image Transformations in JavaScript
Source: https://context7_llms
This JavaScript example shows how to modify an image URL using `URL` and `URLSearchParams` to apply dynamic transformations. It covers resizing by width and height, converting image formats (e.g., to PNG, AVIF), and combining multiple transformations, demonstrating how to manipulate query parameters for image customization.
```javascript
const imageUrl = new URL(image.url);
// Original size
imageUrl.searchParams.delete("w");
imageUrl.searchParams.delete("h");
// Resize to width 400px
imageUrl.searchParams.set("w", "400");
imageUrl.searchParams.delete("h");
// Convert to PNG format
imageUrl.searchParams.delete("auto");
imageUrl.searchParams.set("fm", "png");
// Combined transformations
imageUrl.searchParams.set("fm", "avif");
imageUrl.searchParams.set("w", "400");
imageUrl.searchParams.set("h", "300");
```
--------------------------------
### Download Image Request Body Example in JSON
Source: https://context7_llms
This JSON snippet illustrates the structure of the request body for the `POST /images/{id}/download` endpoint. It specifies optional `effects` (an `ImageEffects` object), desired `resolution` (e.g., 'original', 'small'), and `format` (e.g., 'png', 'jpg') for the downloaded image. Note that certain resolutions are Pro features.
```json
{
"effects": {
/* ImageEffects object */
},
"resolution": "original", // original, small, medium, large, xlarge, ultra
"format": "png" // png, jpg
}
```
--------------------------------
### Listing All Image Categories (HTTP GET)
Source: https://context7_llms
This endpoint retrieves a comprehensive list of all available image categories within the Lummi.ai system.
```HTTP
GET /categories
```
--------------------------------
### Retrieving Random Images from Collection (HTTP GET)
Source: https://context7_llms
This endpoint allows you to get a specified number of random images from a particular collection. You can also apply the same filter parameters as the general /images endpoint.
```HTTP
GET /collections/{id}/images/random
```
--------------------------------
### Implementing Image and Author Attribution in HTML
Source: https://context7_llms
This HTML snippet demonstrates how to properly attribute images and authors using `attributionUrl` properties from the image and author objects. It creates a clickable link to the original source for both the image and the author, fulfilling the attribution guidelines.
```html
```
--------------------------------
### Generating Profile Backgrounds (JSON Request Body)
Source: https://context7_llms
This Enterprise feature allows the generation of custom background images for user profiles. The request body specifies details like profile description, an optional prompt for customization, the number of images to generate (1-3), preferred aspect ratio, and a URL for the person's image.
```JSON
{
"about": "Profile description (job title, location, interests, etc.)",
"prompt": "Optional prompt to customize generation",
"count": 3, // Number of images (1-3, default: 1)
"aspectRatioHint": "16:9", // Preferred aspect ratio
"style": "URL or predefined option",
"person": {
"image": "URL to person's image"
}
}
```
--------------------------------
### Defining Image Object Structure (JSON)
Source: https://context7_llms
This JSON schema defines the structure of an individual image object returned by the Lummi.ai API. It includes comprehensive metadata such as ID, name, description, URLs, author details, image type, dimensions, aspect ratio, size, color palette, tags, categories, and generation details.
```JSON
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "string",
"slug": "cool-cat",
"description": "string",
"detailedDescription": "string",
"vibeDescription": "string",
"url": "https://assets.lummi.ai/assets/abc123",
"attributionUrl": "https://www.lummi.ai/photo/abc",
"author": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"username": "string",
"name": "string",
"avatar": "https://assets.lummi.ai/assets/abc123",
"attributionUrl": "https://www.lummi.ai/creator/abc",
"role": "user"
},
"imageType": "photo", // photo, illustration, 3d
"contentType": "image/png",
"orientation": "square", // square, horizontal, vertical
"width": 123,
"height": 123,
"aspectRatio": 1.23,
"size": 123,
"luminance": 0.12,
"numberOfPeople": 123,
"tags": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "string",
"slug": "cool-cat"
}
],
"categories": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "string",
"slug": "cool-cat"
}
],
"colorPalette": {
"color_name": {
"hex": "#00ff00",
"weight": 0.12
}
},
"colorGroups": ["string"],
"dominantColorGroup": "string",
"dominantColorWeight": 0.12,
"focalPositionX": 0.12,
"focalPositionY": 0.12,
"focalWidth": 0.12,
"focalHeight": 0.12,
"focalZone": "top_left",
"pro": true,
"free": true,
"video": true,
"transparent": true,
"discoverable": true,
"unsafe": false,
"featuredScore": 123,
"trendScore": 12.3,
"viewCount": 123,
"downloadCount": 123,
"collections": 123,
"searchAppearances": 123,
"createdAt": "2025-05-23T22:04:43.787Z",
"updatedAt": "2025-05-23T22:04:43.787Z",
"featuredAt": null,
"becameDiscoverableAt": null,
"blurhash": "string",
"generation": {
"aiModel": "sd",
"batchId": "123e4567-e89b-12d3-a456-426614174000",
"parentId": "123e4567-e89b-12d3-a456-426614174000",
"rootId": "123e4567-e89b-12d3-a456-426614174000",
"prompt": "string",
"aspectRatio": "9:21",
"imageType": "photo",
"shotType": "string",
"trend": "string"
}
}
```
--------------------------------
### Defining Paginated Response Format (JSON)
Source: https://context7_llms
This JSON schema describes the standard format for paginated API responses, typically containing an array of image objects under the 'data' key and metadata such as the total count of items under the 'meta' key.
```JSON
{
"data": [
/* Array of image objects */
],
"meta": {
"totalCount": 123
}
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.