A powerful image editor application built with Next.js and React that lets you generate and edit images using various AI models through Replicate's API.
- Generate images using text prompts with various AI models
- Edit existing images using inpainting and outpainting techniques
- Upload your own images as a starting point
- Maintain a history of all generated and edited images
- Simple and intuitive user interface
- Node.js 18.x or higher
- npm or yarn
- A Replicate API token (get one at replicate.com)
-
Clone this repository:
git clone <repository-url> cd image-editor -
Install dependencies:
npm install # or yarn install -
Create a
.env.localfile in the root directory with the following:REPLICATE_API_TOKEN=your_replicate_api_token_here -
Start the development server:
npm run dev # or yarn dev -
Open http://localhost:3001 in your browser to use the application.
-
Generate a new image:
- Select a generation model from the dropdown
- Enter a text prompt
- Click "Generate"
-
Edit an existing image:
- Upload or select an image from your history
- Draw a mask on the area you want to edit
- Choose between inpaint (replace the selected area) or outpaint (extend the image)
- Enter a text prompt for the edited area
- Click "Apply Edit"
-
View your history:
- All generated and edited images are saved automatically
- Browse through your history in the sidebar
This application requires the following API key:
- Replicate API Token: Used for image generation and editing. Get one at replicate.com.
Add your API key to the .env.local file as shown in the installation section.
The application includes various AI models from Replicate for different image generation and editing tasks. These are configured in src/lib/models.ts.
- Frontend: React, Next.js, TailwindCSS
- Image Processing: Canvas API
- Storage: IndexedDB for local image history
- APIs: Replicate for AI image generation
For advanced users who want to modify the application:
- Image model configurations:
src/lib/models.ts - API integration:
src/lib/api.tsandsrc/app/api/replicate/generate-image/route.ts - Local storage:
src/lib/db.ts
To use your own personal models, create a .env.local file with the following variables:
NEXT_PUBLIC_PERSONAL_MODEL_1="your_model_id_here"
NEXT_PUBLIC_PERSONAL_MODEL_2="your_model_id_here"These models are optional and the app will work perfectly without them.
[Your License Information]
- This project uses Replicate's API for AI image models
- Built with Next.js and Tailwind CSS