If you're looking for an API, you can choose from your desired programming language.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import requests
import base64
# Use this function to convert an image file from the filesystem to base64
def image_file_to_base64(image_path):
with open(image_path, 'rb') as f:
image_data = f.read()
return base64.b64encode(image_data).decode('utf-8')
# Use this function to fetch an image from a URL and convert it to base64
def image_url_to_base64(image_url):
response = requests.get(image_url)
image_data = response.content
return base64.b64encode(image_data).decode('utf-8')
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/sd1.5-outpaint"
# Request payload
data = {
"image": image_url_to_base64("https://segmind.com/image5.png"), # Or use image_file_to_base64("IMAGE_PATH")
"prompt": "streets in italy",
"negative_prompt": "NONE",
"scheduler": "DDIM",
"num_inference_steps": 25,
"img_width": 1024,
"img_height": 1024,
"scale": 1,
"strength": 1,
"offset_x": 256,
"offset_y": 256,
"guidance_scale": 7.5,
"mask_expand": 8,
"seed": 124567
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Image to Segment
Prompt to render
Prompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'
Type of scheduler.
Allowed values:
Number of denoising steps.
min : 25,
max : 100
Desired result image width
Allowed values:
Desired result image Height
Allowed values:
Scale for classifier-free guidance
min : 0.1,
max : 10
Strength controls how much the images can vary
min : 0.1,
max : 1
Offset of the init image on the horizontal axis from the left.
min : 0,
max : 1024
Offset of the init image on the vertical axis from the top.
min : 0,
max : 1024
Scale for classifier-free guidance
min : 0.1,
max : 25
Mask Expansion in pixels uniformly in all four sides, this sometimes helps the model to achieve more seamless results.
min : 0,
max : 256
Seed for image generation.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Unlock the full potential of generative AI with Segmind. Create stunning visuals and innovative designs with total creative control. Take advantage of powerful development tools to automate processes and models, elevating your creative workflow.
Gain greater control by dividing the creative process into distinct steps, refining each phase.
Customize at various stages, from initial generation to final adjustments, ensuring tailored creative outputs.
Integrate and utilize multiple models simultaneously, producing complex and polished creative results.
Deploy Pixelflows as APIs quickly, without server setup, ensuring scalability and efficiency.
Outpainting, also known as "generative fill", "Uncrop", or "Unlimited zoom", is the process of extending an image beyond its original borders, adding new elements in a consistent style or exploring new narrative paths. This model, with its unique capabilities, allows for the creation of surreal and expansive images, pushing the boundaries of traditional image generation.
On the technical side, Stable Diffusion 1.5 Outpainting employs a latent diffusion model that combines an autoencoder with a diffusion model trained in the autoencoder's latent space. The model uses an encoder to transform images into latent representations, with a relative downsampling factor of 8. Text prompts are processed through a ViT-L/14 text-encoder, and the non-pooled output of this encoder is fed into the UNet backbone of the latent diffusion model via cross-attention. The model's loss is a reconstruction objective between the added noise to the latent and the prediction made by the UNet. The strength value, which denotes the amount of noise added to the output image, can be adjusted to produce more variation within the image.
It allows users to break free from the 1:1 aspect ratio limitation of many generative model images, offering the freedom to create larger scenes and expand landscapes. Despite its surreal default nature, the model provides the flexibility to adjust the level of surrealism based on the user's preference. Moreover, it doesn't increase the image size infinitely but pushes the original image deeper into the canvas, mimicking the way cameras work when you take a few steps back.
Customized Digital Artwork: Artists can use the outpainting feature to create unique digital art pieces, expanding the canvas to add more elements and details. This can be particularly useful for creating panoramic landscapes or intricate scenes that require a larger canvas.
Film and Animation: In the film and animation industry, the outpainting feature can be used to extend scenes or backgrounds, providing a cost-effective alternative to manual drawing or CGI. This can be especially useful for creating wide-angle shots or panoramic views.
Advertising and Marketing: Marketers can use outpainting to adjust the aspect ratio of images to fit different advertising mediums. For instance, a square image can be outpainted to a landscape format for a billboard advertisement, or a portrait format for a mobile ad.
Game Design: In the gaming industry, outpainting can be used to generate diverse and expansive game environments. This can help game designers to quickly create new levels or scenes, saving time and resources.
Interior Design and Architecture: Outpainting can be used to visualize different design concepts or architectural plans. For example, an interior designer can use it to extend a room's image to see how it would look with additional elements or changes.
Fashion and Apparel Design: Designers can use outpainting to extend the design of a piece of clothing or an accessory, allowing them to visualize the complete look and make necessary adjustments.
Reimagining Historical or Classic Art: Artists can use outpainting to add a modern twist to historical or classic art pieces, extending the original artwork with new elements or styles.
The model is licensed under the Creative ML OpenRAIL-M license, a form of Responsible AI License (RAIL). This license prohibits certain use cases, including crime, libel, harassment, doxing, exploiting minors, giving medical advice, automatically creating legal obligations, producing legal evidence, and discrimination. However, users retain the rights to their generated output images and are free to use them commercially.
Take a picture/gif and replace the face in it with a face of your choice. You only need one image of the desired face. No dataset, no training
The SDXL model is the official upgrade to the v1.5 model. The model is released as open-source software
Take a picture/gif and replace the face in it with a face of your choice. You only need one image of the desired face. No dataset, no training
AI-Powered Image Super-Resolution, upscaling and Image enhancement producing stunning, high-quality results using artificial intelligence