Sketch to Image

Convert architectural sketches to realistic images

Endpoint

HTTP Method
POST https://api.mnmlai.dev/v1/sketch-to-img

Request

Send a POST request with multipart/form-data containing your sketch or line drawing and specifications for the desired output.

Required Parameters

ParameterTypeDescription
imageFileThe sketch or line drawing to convert (multipart/form-data)
promptStringDescription of the desired realistic image

Optional Parameters

ParameterTypeDefaultDescription
styleString"photorealistic"Rendering style for the output: "photorealistic" | "artistic" | "architectural"
detail_levelString"high"Level of detail in the output: "low" | "medium" | "high"
color_modeString"full_color"Color output mode: "full_color" | "monochrome" | "sepia"
lightingString"natural"Lighting conditions: "natural" | "dramatic" | "soft"

Response

The Sketch to Image endpoint processes your sketch asynchronously. You'll receive a request ID that you can use to check the status and retrieve the generated image once processing is complete.

Success Response (200 OK)

{
  "status": "success",
  "id": "f13wwxqaairs11dmau2czlkaq5",
  "prompt": "Modern house with large windows"
}

Examples

Basic Example

curl -X POST https://api.mnmlai.dev/v1/sketch-to-img \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F "image=@/path/to/sketch.jpg" \
  -F "prompt=Modern house with large windows"

Advanced Example with All Parameters

curl -X POST https://api.mnmlai.dev/v1/sketch-to-img \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F "image=@/path/to/sketch.jpg" \
  -F "prompt=Modern house with large windows" \
  -F "style=photorealistic" \
  -F "detail_level=high" \
  -F "color_mode=full_color"

Node.js Example

const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');

const formData = new FormData();
formData.append('image', fs.createReadStream('/path/to/sketch.jpg'));
formData.append('prompt', 'Modern house with large windows');
formData.append('style', 'photorealistic');
formData.append('detail_level', 'high');
formData.append('color_mode', 'full_color');

const config = {
  method: 'post',
  url: 'https://api.mnmlai.dev/v1/sketch-to-img',
  headers: { 
    'Authorization': 'Bearer YOUR_API_KEY',
    ...formData.getHeaders()
  },
  data: formData
};

axios(config)
  .then(response => console.log(JSON.stringify(response.data)))
  .catch(error => console.log(error));

Python Example

import requests

url = "https://api.mnmlai.dev/v1/sketch-to-img"

payload = {
    'prompt': 'Modern house with large windows',
    'style': 'photorealistic',
    'detail_level': 'high',
    'color_mode': 'full_color'
}

files = {
    'image': open('/path/to/sketch.jpg', 'rb')
}

headers = {
    'Authorization': 'Bearer YOUR_API_KEY'
}

response = requests.post(url, headers=headers, data=payload, files=files)

print(response.json())

Processing Status

After submitting your request, use the Status Check endpoint with the returned ID to monitor processing progress:

Status Check Endpoint
GET https://api.mnmlai.dev/v1/status/{id}

Best Practices

  • Use clear, high-contrast sketches or line drawings with defined edges for best results.

  • Provide detailed prompts that describe the architectural elements, materials, and style you want in the final image.

  • Experiment with different style, detail_level, and lighting parameters to achieve your desired outcome.

Error Handling

For detailed information on error responses, status codes, and best practices for handling errors, see our comprehensive API Errors documentation.

Sketch to Image Specific Errors

// 400 Bad Request - Missing required parameters
{
  "error": "Missing required field: image"
}

// 413 Payload Too Large - File size exceeded
{
  "error": "File size exceeds maximum limit of 10MB"
}

// 400 Bad Request - Invalid sketch format
{
  "error": "Sketch must be a clear line drawing with defined edges"
}

Related Endpoints

Explore other AI-powered design tools: