This application processes client logos and adds them to product images using OpenAI's API, then sends the results via email.
- Install dependencies:
npm install- Create a
.envfile in the root directory with the following variables:
# OpenAI API Configuration
OPENAI_API_KEY=your_openai_api_key_here
# Email Configuration (Gmail)
EMAIL_USER=your.email@gmail.com
EMAIL_PASSWORD=your_app_specific_password
EMAIL_FROM_NAME="Your Company Name"Note: For Gmail, you'll need to use an "App Password" instead of your regular password. You can generate one in your Google Account settings under Security > 2-Step Verification > App passwords.
-
Prepare your
clients.csvfile with the following columns:Name: Client's nameEmail: Client's email addressLogo URL: URL to the client's logo image
-
Create a
product_imagesdirectory and place your product images there:- Supported formats: PNG, JPG, JPEG
- Each image will be processed with the client's logo
Run the application:
npm startThe application will:
- Read client information from
clients.csv - Download each client's logo
- Process each product image with the client's logo using OpenAI's API
- Send all processed images to the client via email
- Clean up temporary files
- Each client will receive an email with all their customized product images
- The customized images will be saved in the root directory with the naming pattern:
{client_name}_product_{number}.png - Temporary logo files are automatically cleaned up after processing