https://github.com/darrylschaefer/nodeoutpainting
Outpaints an image using Node
https://github.com/darrylschaefer/nodeoutpainting
ai image image-generation image-manipulation openai outpainting
Last synced: 13 days ago
JSON representation
Outpaints an image using Node
- Host: GitHub
- URL: https://github.com/darrylschaefer/nodeoutpainting
- Owner: darrylschaefer
- License: mit
- Created: 2024-04-15T17:11:01.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-15T17:18:02.000Z (about 2 years ago)
- Last Synced: 2025-07-27T21:01:08.787Z (10 months ago)
- Topics: ai, image, image-generation, image-manipulation, openai, outpainting
- Language: JavaScript
- Homepage:
- Size: 13.5 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# NodeOutpaint
## Overview
This script takes an input image, divides it into four squares, uses the Dall-E 2 OpenAI API point to extend these images and reassembles them into a larger (2048px x 2048px) image.
You can use it to outpaint or extend (Dall-E 2, Dall-E 3) generations as long as the input generation is 1024px by 1024px.
Before:

After:

## Installation
To set up the project on your local machine, follow these steps:
1. Ensure that Node.js is installed on your system. You can download and install it from [Node.js official website](https://nodejs.org/).
2. Clone the repository to your local machine or download the source code.
3. Navigate to the project directory and install dependencies:
```bash
npm install
```
4. Modify processImage.js and reprocessCorner.js scripts with your OpenAI API key (line 7).
## Usage
To run the application, you need to provide an image file. Place your input image in the root of the project directory. Use the following command to start the image processing:
```bash
node processImage.js image_filename.jpg "Your image prompt goes in this string"
```
Replace `'image_filename.jpg'` with the path to your input image. There's an example.jpg included - so feel free to use that one to test it out!
Dall-E 2 Edits Endpoint can be inconsistent when given 1/4 of an image to extend. This will likely require you to request remakes of specific corners until you find something visually consistent. There's a secondary script for generating a new corner and rebuilding the master image.
### Fixing a Corner
You can fix a corner by running the following command:
```bash
node reprocessCorner.js corner "Your image prompt goes in this string"
```
Replace "corner" with the corner to be replaced (bottomLeft, bottomRight, topLeft, topRight). Add your prompt to be used to extend the image!
## Tips
Higher detail source images (from Dall-E 3) seem to work better for consistent outpainting. Lower detailed, abstract images cause a lot of hallucinations (artifacts, spontaneous faces, random text) to appear in the edits.
Increasing the amount of source image that is fed into the Edits API will probably increase the consistency and quality of the outputs however this script is currently not modified to do that.
## Inspiration
This project was inspired by dalle2_outpaint by mdbecker! https://github.com/mdbecker/dalle2_outpaint
## Support
For any issues or questions regarding the application, please open an issue in the project repository on GitHub.