Stable Image Core - Search and Replace
Intelligently search for specific objects in images and replace them with AI-generated alternatives using Stability AI's advanced object detection and inpainting technology. Simply describe what to find and what to replace it with, and the AI will automatically locate, mask, and replace the objects while maintaining natural image composition.
Endpoint
Request Headers
| Field | Value |
|---|---|
| API-KEY | <api-key> |
| Content-Type | application/json |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Feature type identifier. Must be SEARCH_AND_REPLACE |
model | string | Yes | AI model identifier. Must be stable-image |
promptObject | object | Yes | Configuration object containing all search and replace parameters |
Prompt Object Parameters
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
imageUrl | string | Yes | Path to the source image containing objects to replace | - |
search_prompt | string | Yes | Description of the object(s) to search for and replace | - |
prompt | string | Yes | Description of what to replace the found object(s) with | - |
output_format | string | No | Output format for the processed image | png |
Supported Output Formats
| Format | Description | Best For |
|---|---|---|
png | High quality lossless format with transparency support | Professional use, detailed images, archival quality |
jpeg | Compressed format suitable for photographs | Web optimization, social media, smaller file sizes |
webp | Modern format with superior compression | Web applications, modern browsers |
Search Prompt Guidelines
| Guideline | Description | Example |
|---|---|---|
| Be Specific | Use clear, descriptive terms for objects | "red apple" instead of "fruit" |
| Single Objects | Focus on one type of object per request | "banana" not "banana and orange" |
| Common Terms | Use everyday language the AI understands | "car" instead of "automobile" |
| Visual Properties | Include color, size, or distinctive features | "blue bicycle", "large tree" |
Replacement Prompt Best Practices
| Practice | Description | Example |
|---|---|---|
| Descriptive Language | Use vivid, clear descriptions | "a bright yellow sunflower" |
| Style Consistency | Match the original image style | "a realistic red rose" for photo, "a cartoon dog" for illustration |
| Contextual Fit | Ensure replacement fits the scene | Replace "banana" with "green apple" in kitchen scene |
| Natural Integration | Consider lighting and perspective | "a wooden chair facing the same direction" |
Code Examples
- cURL
- JavaScript
- Python
curl --location 'https://api.1min.ai/api/features' \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"type": "SEARCH_AND_REPLACE",
"model": "stable-image",
"promptObject": {
"imageUrl": "development/images/2025_02_16_15_00_19_886_banana.jpg",
"search_prompt": "banana",
"prompt": "a purple eggplant",
"output_format": "png"
}
}'
fetch('https://api.1min.ai/api/features', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'API-KEY': 'YOUR_API_KEY'
},
body: JSON.stringify({
type: 'SEARCH_AND_REPLACE',
model: 'stable-image',
promptObject: {
imageUrl: 'development/images/2025_02_16_15_00_19_886_banana.jpg',
search_prompt: 'banana',
prompt: 'a purple eggplant',
output_format: 'png'
}
})
})
import requests
url = "https://api.1min.ai/api/features"
headers = {
"Content-Type": "application/json",
"API-KEY": "YOUR_API_KEY"
}
data = {
"type": "SEARCH_AND_REPLACE",
"model": "stable-image",
"promptObject": {
"imageUrl": "development/images/2025_02_16_15_00_19_886_banana.jpg",
"search_prompt": "banana",
"prompt": "a purple eggplant",
"output_format": "png"
}
}
response = requests.post(url, headers=headers, json=data)
Interactive Playground
API Playground
https://api.1min.ai/api/featuresPath to the source image containing objects to replace
Description of the object(s) to find and replace
Description of what to replace the found object(s) with
Format of the output image with objects replaced
Generated cURL Command:
curl -X POST "https://api.1min.ai/api/features" \
-H "API-KEY: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{
"type": "SEARCH_AND_REPLACE",
"model": "stable-image",
"promptObject": {
"imageUrl": "development/images/2025_02_16_15_00_19_886_banana.jpg",
"search_prompt": "banana",
"prompt": "a purple eggplant",
"output_format": "png"
}
}'
Response Format
{
"aiRecord": {
"uuid": "s1r2p3l4-v5e6-7890-abcd-ef1234567890",
"userId": "user-12345",
"teamId": "team-67890",
"teamUser": {
"teamId": "team-67890",
"userId": "user-12345",
"userName": "John Doe",
"userAvatar": "https://example.com/avatar.jpg",
"status": "ACTIVE",
"role": "ADMIN",
"creditLimit": 100000000,
"usedCredit": 35000,
"createdAt": "2025-01-01T00:00:00.000Z",
"createdBy": "SYSTEM",
"updatedAt": "2025-01-15T15:30:00.000Z",
"updatedBy": "SYSTEM"
},
"model": "stable-image",
"type": "SEARCH_AND_REPLACE",
"metadata": null,
"rating": null,
"feedback": null,
"conversationId": null,
"status": "SUCCESS",
"createdAt": "2025-01-15T15:30:00.000Z",
"aiRecordDetail": {
"promptObject": {
"imageUrl": "development/images/2025_02_16_15_00_19_886_banana.jpg",
"search_prompt": "banana",
"prompt": "a purple eggplant",
"output_format": "png"
},
"resultObject": [
"development/images/2025_01_15_15_30_45_001_search_replaced.png"
],
"responseObject": {}
},
"additionalData": null,
"temporaryUrl": "https://s3.us-east-1.amazonaws.com/asset.1min.ai/development/images/2025_01_15_15_30_45_001_search_replaced.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=EXAMPLE_CREDENTIAL&X-Amz-Date=20250115T153000Z&X-Amz-Expires=604800&X-Amz-Signature=example_signature&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject"
}
}
Use Cases
Content Creation & Digital Art
- Creative Variations: Experiment with different objects in artistic compositions
- Concept Development: Quickly test various design elements in mockups
- Artistic Exploration: Transform everyday objects into fantastical alternatives
- Style Experimentation: Replace objects to match different artistic themes
- Visual Storytelling: Change objects to alter narrative elements in images
E-commerce & Product Photography
- Product Variations: Show different color variations or product alternatives
- Seasonal Updates: Replace seasonal items with year-round alternatives
- A/B Testing: Test different product presentations for marketing effectiveness
- Inventory Visualization: Show how different products look in same settings
- Brand Consistency: Replace competitor products with brand alternatives
Marketing & Advertising
- Campaign Customization: Adapt images for different markets or demographics
- Localization: Replace culture-specific objects for international campaigns
- Seasonal Marketing: Update promotional images with seasonal alternatives
- Brand Integration: Replace generic objects with branded alternatives
- Target Audience Customization: Tailor images for specific customer segments
Education & Training Materials
- Learning Scenarios: Create variations of educational content for different contexts
- Visual Examples: Replace objects to demonstrate concepts or principles
- Accessibility: Replace complex objects with simpler alternatives for learning
- Cultural Adaptation: Update educational materials for different cultural contexts
- Subject Matter Exploration: Show how changing objects affects outcomes
Photography Enhancement & Restoration
- Creative Photography: Experiment with alternative compositions after shooting
- Historical Updates: Replace outdated objects with modern alternatives
- Fantasy Photography: Transform realistic scenes into fantastical environments
- Mood Enhancement: Replace objects to change the emotional tone of images
- Style Consistency: Ensure visual coherence across photo series
Social Media & Content Marketing
- Trend Adaptation: Replace objects to match current social media trends
- Engagement Boost: Create multiple versions of content for better engagement
- Hashtag Optimization: Replace objects to match trending hashtags
- Audience Targeting: Customize content for different social media demographics
- Viral Content Creation: Transform images to increase shareability
Advanced Use Cases
Architectural & Interior Design
- Furniture Visualization: Replace furniture pieces to show different design options
- Color Scheme Testing: Change object colors to test interior design palettes
- Style Matching: Replace objects to match specific design aesthetics
- Client Presentations: Show multiple design options in same space
Fashion & Lifestyle
- Style Coordination: Replace accessories or clothing items for outfit variations
- Seasonal Collections: Transform items to match seasonal fashion trends
- Brand Collaborations: Replace items with partner brand alternatives
- Trend Forecasting: Visualize how trends might look in different contexts
Tips for Best Results
-
Object Detection Optimization: Ensure AI can accurately identify target objects
- Clear Visibility: Objects should be clearly visible and well-lit in the image
- Distinct Boundaries: Avoid objects that blend heavily with background
- Common Objects: Use search terms for objects the AI is trained to recognize
- Single Focus: Target one type of object per request for better accuracy
-
Search Prompt Effectiveness: Write clear, specific search descriptions
- Precise Language: Use specific terms rather than generic categories
- Visual Descriptors: Include color, size, or distinctive features when relevant
- Singular Focus: Search for one object type at a time for best results
- Common Terminology: Use everyday language the AI understands
-
Replacement Prompt Quality: Create compelling replacement descriptions
- Detailed Descriptions: Provide rich, descriptive language for replacements
- Style Consistency: Match the artistic style and mood of the original image
- Contextual Fit: Ensure replacements make sense in the scene context
- Natural Integration: Consider lighting, shadows, and perspective
-
Image Quality Considerations: Use high-quality source images
- High Resolution: Better resolution provides more accurate object detection
- Good Lighting: Well-lit images help AI distinguish objects and backgrounds
- Clear Focus: Sharp images with distinct objects work best
- Minimal Occlusion: Objects should be mostly visible, not heavily obscured
-
Creative Techniques: Maximize creative potential
- Iterative Refinement: Try multiple replacement prompts to find the best result
- Style Matching: Consider the artistic style of the original when describing replacements
- Context Awareness: Ensure replacements fit logically in the scene
- Experimentation: Try unexpected combinations for creative results
-
Technical Optimization: Optimize for processing and output
- Format Selection: Choose appropriate output format for intended use
- Processing Time: Complex replacements may take longer to process
- Quality Assessment: Review results and adjust prompts if needed
- Batch Processing: Process similar replacements separately for consistency
Common Search and Replace Scenarios
Object Transformation Examples
| Search Term | Replacement Examples | Use Case |
|---|---|---|
"red car" | "blue bicycle", "yellow taxi", "green motorcycle" | Transportation alternatives |
"wooden chair" | "leather armchair", "metal stool", "bean bag" | Furniture variations |
"apple" | "orange", "banana", "strawberry" | Food alternatives |
"dog" | "cat", "rabbit", "bird" | Pet alternatives |
"flowers" | "succulents", "herbs", "vegetables" | Plant variations |
Creative Transformation Ideas
- Seasonal Changes: Replace summer items with winter alternatives
- Cultural Adaptation: Replace culture-specific objects for global audiences
- Fantasy Elements: Transform ordinary objects into magical alternatives
- Historical Context: Replace modern objects with historical equivalents
- Futuristic Vision: Replace current objects with futuristic alternatives
Notes
- Stable Image Core Search and Replace combines advanced object detection with intelligent inpainting for seamless object replacement
- Results quality depends on object visibility, search prompt accuracy, and replacement prompt creativity
- The model excels at replacing common, well-defined objects with clear boundaries
- Processing times vary based on image complexity, object size, and replacement complexity
- For best results, use specific search terms and detailed replacement descriptions
- Multiple iterations may be needed to achieve the perfect replacement result
- The AI maintains lighting, shadows, and perspective consistency in replaced objects