architectural rendering with ChatGPT

Architectural Image Variations with DALL·E 2

There is an image variations endpoint available through OpenAI’s API that creates variations of images with DALL·E 2.

Variations are a useful method if you want to retain some of the image style, opposed to trying to generate new images with an image input prompt through ChatGPT.

Here is a Python script that generates 2 variations from an input image.

Python Script

  1. Prepare the input image.
    • Requirements: PNG less than 4MB
  2. Create a Python file called variations.py
  3. Run command “python variations.py “path/to/your/image.png”
    • Tip: right click your image to “Copy Path” to clipboard, paste this after variations.py
  4. Modifying: change “n” to a different number to generate more options. Each will print to the console you run the command from.
from openai import OpenAI
import sys
openai_client = OpenAI(api_key="YOUR API KEY")


def create_image_variation(input_path):
    try:
        # OpenAI Request
        response = openai_client.images.create_variation(
            model="dall-e-2",
            image=open(input_path, "rb"),
            n=2,
            size="1024x1024"
        )
    

        for data in response.data:
            # Display image url in console
            print(f"Generated Image URL: {data.url}")

    except Exception as e:
        print(f"Error: {e}")

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: python image_variation.py <input_image_path>")
    else:
        input_path = sys.argv[1]
        create_image_variation(input_path)

Terminal Command

Here is an example command, assuming you are in the current directory where variation.py is located. For example, my terminal path looks like this. We are in the tools directory where variation.py was created: C:\Users\matt\Apps\newcolor\apps\tools>

python variation.py "C:\Users\matt\Desktop\2.png" 

Architectural Sketch Variations

The following inputs are original architectural sketches. DALL·E 2 translates the abstract designs and rearranges elements while retaining the original style.

Sketch #1

Sketch #1: Varation 2
Original Sketch #1
Architectural Image Variations with DALL·E 2 1
Sketch #1: Varation 1
Architectural Image Variations with DALL·E 2 2
Sketch #1: Varation 2

Sketch #2

Original Sketch #2
Original Sketch #2
Sketch #2: Variation 1
Sketch #2: Variation 1
Sketch #2: Variation 2
Sketch #2: Variation 2

Sketch #3

Original Sketch #3
Original Sketch #3
Sketch #3: Variation 1
Sketch #3: Variation 1
Sketch #3: Variation 2
Sketch #3: Variation 2

Sketch #4

Sketch #4: Variation 2
Original Sketch #4
Sketch #4: Variation 1
Sketch #4: Variation 1
Architectural Image Variations with DALL·E 2 3
Sketch #4: Variation 2

ChatGPT Architectural Image Variations

The following are renderings from ChatGPT. I sent the sketch and asked for an architectural rendering based on the original sketches. Can you match the rendering to the input sketch? How well do you think it translated the ideas of the sketches?

architectural rendering image variation
architectural rendering image variation
architectural rendering image variation
architectural image variations
Please follow and like us: