10 prompts - 1000 AI generated images - openAI Dall-E

CaffeineFueled

2022/12/15

Table of content

What is this all about?

We were curious about how much variance the AI has. So, what would be the results if we were to request 100 images with the same prompt? - I won’t review the results and rather just present the results to you.

These prompts are a result of a quick brain storming. If you have suggestions, please let me know. I might create more posts like this in the future. The goal was to have a wide range to motives, styles, and so.

These images are unedited. Generated - downloaded - created a montage; that is it. These images are free for personal or commercial use and do not require any form of mentioning. Dall-e gives ownership of the images to me, and I give you permission to do with it, whatever you want.

The resolution of the originals is 1024x1024 and I might provide a download link at some point. If you want a single image, feel free to reach out.

With testing, the total costs were around 20 EUR. I’d say that it is acceptable.

You can find a technical write-up at the end of the post. But as a disclaimer: not best-practice. Feedback is still appreciated.

Gallery

So, enjoy!

1 - Cats #

photo of a kitten on a carpet in the living room, digital art

cats


2 - Robot #

small robot wandering around in an post-apocalyptic world, digital art

robot


3 - Donut #

minimalist logo of a donut shop

donut


4 - Dackel #

dackel in a suit in a library, digital art

dackel


5 - Poster #

movie poster for an action movie from the 80s, digital art

poster


6 - Citylife #

a black and white photo of the life in new york

citylife


7 - Dolphin #

sticker illustration of a cute dolphin

dolphin


8 - Light <a href="#light id=“light”>#

area view of a city with street lights at night, digital art

light


9 - Monster #

detailed sketch of an evil monster, digital art

monster


10 - Cyberpunk #

realistic photo of a colorful cyberpunk city in the rain at night, digital art

cyberpunk


Tech write-up #

Side note: To be clear, this is not best-practice. It got its job done, and that is all I needed. Still, feel free to reach out, happy to learn!

First, openai Dall-E API offers to generate the following sizes, with 3 different prices:

Resolution 	Price
1024×1024 	$0.020 / image
512×512 	$0.018 / image
256×256 	$0.016 / image

I’ve generated the largest resolution.

Limitations

So, I’ve decided to use the API via curl, the first limit I encountered is the ‘10 images per request’.

{
  "error": {
    "code": null,
    "message": "20 is greater than the maximum of 10 - 'n'",
    "param": null,
    "type": "invalid_request_error"
  }
}

The next one would be the rate limit of 50 images per 5 minutes.

{
  "error": {
    "code": null,
    "message": "Rate limit reached for images per minute. Limit: 50/5min. Current: 60/5min. Please visit https://help.openai.com/en/articles/68839691 to learn how to increase your rate limit.",
    "param": null,
    "type": "requests"
  }
}

In the end, the download of the generated images was limited too. After every category I had to switch to another VPN server location to bypass the limit.

Script to download them all!

I did a small break after every category to check the result of the script, and whether all images were generated and downloaded.

I’ll add some comments later, but in short:
generate images and put curl response to file
get URL from output file and remove the quotation marks "
download images via curl
wait one minute to avoid rate limit
#!/bin/bash

# For for-loop for the whole script due to the limitations
# Curl request to generate the images via API, and the save the output via -o flag to a file

for i in {1..10};
do
  echo $i

  curl -o output.txt https://api.openai.com/v1/images/generations \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-sdsdskdsdsdsdeefefe" \
    -d '{
      "prompt": "small robot wandering around in an post-apocalyptic world, digital art",
      "n":10,
      "size":"1024x1024"
    }'

# Gets the URLs of the generate images, removes quotation marks, and saves it to a new file (one URL per line)
  cat output.txt | jq '.data[].url' | sed 's/"//g' > output_url.txt

# Finally, download images with curl to the current directory. I was told that this is not bet practice, but it worked.
  cat output_url.txt  | while read f; do curl "${f}" -O; done;

# wait 60 seconds before we start it all over again
  sleep 60
done

Things to improve: start/stop, logs, error and information notification, speed

Rename everything

In the next step, I had to rename all the files. The file names were cryptic and difficult to work with.

#!/bin/bash
a=1
n=cats
for i in ./1_cats/*; do
  new=$(printf "./1_cats/"$n"_%04d.jpg" "$a")
  mv -i -- "$i" "$new"
  let a=a+1
done

The name scheme would look like: cats_0001.png

Create montage with imagemagick

In the last step, I used imagemagick to create a montage with the following command.

montage -geometry 200x200+2+2 -tile 4x -set label '%f' *.jpg montag.jpg

Explanation:
montage # imagemagick function to create montages
-geometry 200x200+2+2 # size per image + min size of the padding between the images
-tile 4x # setting for the layout, 4 columns, unlimited rows. 3x4 would be a limit of 3 columns and 4 rows
-set label '%f' # adds the filename of the image on the montage
*.jpg # use ALL .jpg file within this directory for the montage
montag.jpg # name and format of the final montage



Most recent Articles:
  • Notice Board 003: Progress is Progress
  • How to: Cisco ISE backup to SFTP repository with public key authentication
  • Dummy IP & MAC Addresses for Documentation & Sanitization
  • Deploying ISSO Commenting System for Static Content using Docker
  • Generate a Vanity v3 Hidden Service Onion Address with mkp224o