#Auto image expander

72 messages · Page 1 of 1 (latest)

sly beacon
#

This is a work in progress project it uses DALLE-2 to expand the image automatically with the auto generated prompt
The marked points in this example are the centers for each generation frame, which so far took the most amount of work to make
the points are generated based on the desired amount of context that DE2 will be given and the size of the final image.
it has a specific order that generates the sides before corners in order to give the AI more context when generating the corners, but also without overlapping too much in order to make the generation get too few new pixels

#

Original image

#

It can expand an image in all directions and generates points accordingly depending on the desired final size for the image

#

for exmaple, an 1024x1024 to 1920x1080 with the image at the bottom center, it would generate like this

#

and any other crazy resolutions, for example.. 2000x2000 with the source image at the top left

#

// this script will probably not be shared

odd tartan
#

Nice! Well done.

vestal steeple
#

Well done! how do you get a text description of an image?

sly beacon
wary roost
#

What coding language did you use?

sly beacon
#

Typescript

#

but im having issues with the replicate lib, I might convert it to plain JS

sly beacon
#

Looks like it works just as fine with no prompt at all, which is good because that way, no extra API is needed

#

but it has to do smaller steps in order for the AI not have the opportunity to hallucinate random stuff

wary roost
#

You can always just write the style in the prompt but not the subject. Since it may end up being out of frame later.

I've been doing no prompt for a while but half the time it seems to turn the image into an album cover or something else with text in it.

sly beacon
#

yea, but it is supposed to work with any image

wary roost
#

Yeah that’s what I’ve been doing but it hasn’t been great half the time

sly beacon
#

do you have some images that where not great for you?

#

I could use them to test if it works for me

wary roost
sly beacon
#

but was the original cropped?
i mean, did it had those borders?

wary roost
#

Starting with this. The above image wasn't even using the expansion yet, I just added padding.

sly beacon
#

oh

#

I know the problem, you expanded the image on all sides at the same time

#

with no prompt

#

that is too much "emptyness" for Dalle, it will hallucinate too much

wary roost
#

With my expander it expands the left right top bottom, then does the corners. It keeps half of the original image for the first four expansions.

#

I feel like if I write the subject it don't do it, but I'll fix that later.

sly beacon
#

half of the image is also too much

#

200 pixels.. 300 max

wary roost
#

oh, how much do you do?

#

Ok I'll fix that too, thanks

sly beacon
#

here is an example, the step was too high:

#

still coherent, but this weas never intended to be part of the image

#

it added a person

wary roost
#

I see

wary roost
sly beacon
#

just because =P

#

from 1024 to 2000

lean rampart
#

Simple image work on computer

#

Auto image expander work on computer

dusty grotto
#

@sly beacon github link?

sly beacon
#

I would be happy to give advice to anyone trying to make a similar one =P

#

just ask if needed

dusty grotto
sly beacon
#

bessides the openAI API docs, you should check the documentation of watever image manipulation libs you are going to use

#

this code all boild sown to handling the generation frame

sly beacon
sly beacon
#

the process is basically:
1- take the original image and add a huge transparent margin to make it bigger than the desired resolution
2- generate the center points where the generation frame will be positioned
3- for each point of the generation frame, produce a standalone 1024x1024 piece, apply the OpenAI API image generation method, then, take the result from it and composite that result image back into the large transparent image
4 - crop the image to trhe desired size, and it is done

#

the msot important part of it all is the point generation, as it has some requirements, for example, avoid having the cente rpoint positioned in such a way that will cause pixels to be created in a area that would be outside of the final image (as it will be just wasteful)

inland gorge
sly beacon
#

this is a private project, just a showcase, not a actual self promotion of a service

#

I might make something similar and open source in the future

#

but not yet

inland gorge
#

ok fine. 👍

knotty stream
sly beacon
#

I made it

#

=P

dawn flume
#

so ur not releasing it ?

steady dew
delicate iron
#

@sly beacon Have an update about this?

sly beacon
#

I actually had improved the script for my petsonal usage, but i plan to actually make a complete new version and release it

#

Probably in the near future