## DEV Community

Alireza Shabani

Posted on • Updated on

# Generate All Possible Images!

Let's discuss a HUGE project but so useful one!
The main idea is to generate all possible pictures with a specific resolution such as 1080×1920.

# Why:

Your first question might be, why the hell should this happen?

Cause it is literally EVERYTHING!!! Everything has happened, Everything that will happen, it can be a huge resource of inspiration, it can be leaked photos, it can be any media that will be released tomorrow, it can be exactly the future. This is "Why".

If we want to generate all 1080p pictures, it will be around

`< 1080*1920*255*255*255 = 3.47892351×10¹³ >`

, it is noticeable we are facing two different issues:

Time
Size

Therefore i though as the first step , i should use a lower resolution to generate , so i did some research:

○ 352 x 240 (240p)
○ 480 x 360 (360p)
○ 858 x 480 (480p)
○ 1280 x 720 (720p)
○ 1920 x 1080 (1080p)
○ 3860 x 2160 (2160p)

The best choice is 240p. it will be something like:

Alright, Let's check a number of possibilities:

`240×352×256×256×256 = 1.417339208×10¹²`

it is still a lot but with a huge difference in size.
so I had another idea, limiting the range of red/green/blue:

# 2 Different Ways

## Option 1

instead of having (256³)=16777216 options for each pixel , have ((256/8)³)=32768 => we saved 16777216/32768=512 , in other words (240×352×32*32*32)=2768240640 possibilities

How About analysing size and time:

# Size:

Each .Jpg format 240p : 51KB (maximum)
Each .Png format 240p : 254KB (maximum)
It is clear we have to use .jpg format.
All possible pictures size will be :

`(240×352×32*32*32)*51KB = 141180272640KB or 137871360MB or 134640GB or 131TB`

# Time:

Each pixel (in a loop not random) takes 0.000000166

Each 240p picture generate takes

`(0.000000166*(352*240))+0.08 = 0.09402368`

Then for all Possible pictures, it takes

`0.01*2768240640= 27682406.4 sec or 461373.4 min or 7689.5 hour or 320.3 days`

## Option 2

instead of having (256³)=16777216 options for each pixel , have ((256/32)³)=512 => we saved 16777216/512=32768 , in other words (240×352×8*8*8)=43253760 possibilities

How About analysing size and time:

# Size:

Each .Jpg format 240p : 51KB (maximum)
Each .Png format 240p : 254KB (maximum)
It is clear we have to use .jpg format.
All possible pictures size will be :

`(240×352×8*8*8)*51KB = 2205941760KB or 2154240MB or 2103.7GB or 2.05TB`

# Time:

Each pixel (in a loop not random) takes 0.000000166

Each 240p picture generate takes

`(0.000000166*(352*240))+0.08 = 0.09402368`

Then for all Possible pictures, it takes

`0.01*43253760= 432537.6 sec or 7208.9 min or 120.1 hour or 5 days`

Thanks for your attention, hope you like the idea and I really love to see your ideas to optimize!

Revisto

Muhimen

So, have your code started running?

Alireza Shabani • Edited

not yet , looking to optimize

Muhimen

Do you mean optimize?

Alireza Shabani

definitely

Frank

99.99% of all the possible images will be just trash
How about running each imh through a image classifier and see if the creation is something detectable or not. 🤔😂😂

acornavi

You use available images/videos to create vectors or classes.

acornavi

I'm working on this project since 1989. I call it Aleph. Actually, there is a limited number of images that could be used for further analysis and data extraction. First, remove all negatives, remove all white noise-based images to a certain degree of very low patterning, remove all mirror images and all repetition images. This cuts significantly the final number of the images.. The next step si to optimize the way you record data, binary code is taking the most memory.
My project is based on the idea that science can search a database instead of researching real data. Please contact me if you are interested in cooperation. Thanks!