I want to discuss a task or project
Done! We will get back to you within one business day
Something went wrong. Please try again
Alexander Start:Duck 🦢
@olga_startduck
Write to Telegram
Назад
1k+ участников
Вступить в Telegram
n8n
05.09.2025

Photo AD System - Automated system for creating advertising photos

Process description

This automation is an intelligent system for turning ordinary product photos into professional commercial-quality studio shots. The user sends a product photo to the Telegram bot, the system analyzes the image via Google Gemini 2.5 Flash with computer vision, creates several versions of professional images with different shooting angles, lighting and backgrounds, while maintaining 100% accuracy of the original product, and sends the result back to the user.

API keys and services:

  1. Telegram Bot API - for receiving and sending images (bot: Photo editor)
  2. Google Gemini 2.5 Flash Image Preview API - for AI image processing

System architecture by blocks

SECTION 1: IMAGE ACQUISITION

1.1 Telegram Trigger — Monitoring incoming messages

Purpose: Automatically receives messages with photos from users on Telegram

Telegram Trigger settings:

  • Updates: ["message"] (tracking new messages)
  • Additional Fields: {} (default settings)
  • Webhook ID: 15ecbc09-e385-4fbe-ada5-0389acc8ee60
  • Credentials: Your tg bot

What we get:

{

“message”: {

“message_id”: 123,

“chat”: {

“id”: 987654321,

“type”: “private”

},

“photo”: [

{

“file_id”: “AgacagiaAxkbaai... “,

“file_unique_id”: “AqadBwad... “,

“width”: 1280,

“height”: 720,

“file_size”: 87654

}

],

“caption”: “Advertising product - iPhone smartphone”

}

}

Signature processing (caption): The system uses the photo caption as a context for AI - what kind of product is depicted and what result is expected.

1.2 Get a file - Upload an image file

Purpose: Receives an image file from the Telegram API for further processing

Telegram settings:

  • Resource: file
  • File ID: {{$json.message.photo [0] .file_id}} (first image ID)
  • Additional Fields: {} (default settings)
  • Credentials: Photo editor

Download process:

  1. Extracts file_id from an array of photos
  2. Makes a request to the Telegram API to get file_path
  3. Downloads binary image data
  4. Prepares for further processing

SECTION 2: IMAGE PREPARATION

2.1 Extract from File - Convert to Base64

Purpose: Converts a binary image to Base64 format for transfer to the AI API

Settings:

  • Operation: BinaryToProperty (extract to property)
  • Options: {} (default settings)

The result: Base64 image string in the data property for use in an API request.

SECTION 3: AI IMAGE PROCESSING

3.1 generate_image - Creating professional photos

Purpose: Uses Google Gemini 2.5 Flash to create studio versions of the original product

API settings:

  • Method: POST
  • URL: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent
  • Authentication: HTTP Header Auth (Gemini credentials)
  • Model: gemini-2.5-flash-image-preview

Detailed system prompt:

Transform this exact product image ({{caption}}) into professional studio photography with multiple variations while STRICTLY PRESERVING the original product:

CRITICAL PRESERVATION RULES:

- EXACT product reproduction: NO changes to shape, proportions, or design

- TEXT INTEGRITY: All text, labels, logos must remain 100% accurate - no distortion, no typos, no font changes

- Preserve ALL original details: serial numbers, brand marks, textures, materials

- Maintain exact colors and finishes of the product itself

- Keep all product features identical to source image

- DO NOT alter, stylize or reimagine the product - only improve photography

LIGHTING SETUP (apply without changing product):

- Key light: Softbox at 45° angle, creating gentle shadows

- Fill light: Reducing shadow intensity by 60%

- RIM/back light: Creating edge separation from background

- Optional accent light for texture highlights

- Ensure lighting reveals but doesn't alter product details

BACKGROUND OPTIONS (product remains unchanged):

1. Pure white infinity curve (cyclorama)

2. Subtle gradient from white to light gray

3. Dark luxury background with spot lighting

4. Soft pastel gradient complementary product colors

PHOTOGRAPHY STYLES (4-6 shots, product identical in all):

- Hero shot: Centered, straight-on angle

- 3/4 view: Dynamic angle showing depth

- Detail macro: Close-up of key features/textures

- Floating product: With subtle drop shadow

- Lifestyle context: Minimal props, premium feel

- Top-down flat lay: Organized, symmetric composition

POST-PROCESSING CONSTRAINTS:

- Remove ONLY environmental flaws (dust, scratches on surface, not product)

- Enhanced sharpness WITHOUT altering product geometry

- Color correction for lighting ONLY - product colors stay true

- Add subtle reflection on glossy surface below

- Consistent white balance across all shots

- Light vignetting for focus

- Professional retouching that doesn't modify the product itself

QUALITY CHECKS:

- Compare with original: product must be identical

- All text readable and unexpected

- No AI hallucinations or invented details

- Product authenticity maintained

OUTPUT: High resolution, e-commerce/advertising ready, photorealistic studio quality with the EXACT original product

JSON Body configuration:

{

“model”: “gemini-2.5-flash-image-preview”,

“contents”: [

{

“parts”: [

{

“text”: “[full prompt above]”

},

{

“inlineData”: {

“mimeType”: “image/jpeg”,

“data”: “{{$json.data}}”

}

}

]

}

],

“GenerationConfig”: {

“temperature”: 0.5,

TopK: 40,

“TopP”: 0.95,

“MaxOutputTokens”: 8192

}

}

Generation parameters:

  • Temperature: 0.5 (moderate creativity)
  • TopK: 40 (token selection limit)
  • TopP: 0.95 (nucleus sampling)
  • MaxOutputTokens: 8192 (enough for multiple images)

SECTION 4: PROCESSING RESULTS

4.1 Code — Extracting generated images

Purpose: Parses the response from the Gemini API and extracts all created images

JavaScript code:

const items = [];

const response = $input.first () .json;

//Extract only images (parts with odd indices)

const parts = response.candidates [0] .content.parts;

//Take only items from InlineData (images)

for (let i = 0; i < parts.length; i++) {

if (parts [i] .inlineData && parts [i] .inlineData.data) {

items.push ({

json: {

data: parts [i] .inlineData.data,

MimeType: parts [i] .inlineData.mimeType || 'image/jpeg'

}

});

}

}

return items;

Processing logic:

  1. Receives a response from the Gemini API
  2. Searches for parts with images (InlineData)
  3. Extracts Base64 data from each image
  4. Creates an array of objects for further processing

4.2 Convert to File1 - Binary conversion

Purpose: Converts Base64 images back to binary format for submission

Settings:

  • Operation: Tobinary
  • Source Property: data (Base64 data)
  • Options: {} (default settings)

SECTION 5: SUBMITTING RESULTS

5.1 Send a photo message - Send retouched photos

Purpose: Sends all professional photos created back to the user

Telegram settings:

  • Operation: SendPhoto
  • Chat ID: {{$ ('Telegram Trigger') .item.json.message.chat.id}} (same user)
  • Binary Data: true (sending binary data)
  • Additional Fields: {} (no additional fields)

The result: The user receives 4-6 professional versions of their product photo.

Node connection diagram

Main stream:

  1. Telegram TriggerGet a fileExtract from File
  2. Extract from Filegenerate_imageCode
  3. CodeConvert to File1Send a photo message

Multiple image processing:

The system automatically processes all generated versions of photos and sends them to the user one by one.

Required services and their settings

Telegram Bot setup:

  • Create a bot via @BotFather
  • Get a Bot Token
  • Set up a webhook to receive images

Google Gemini setup:

  • Get the API key on ai.google.dev
  • Enable Gemini 2.5 Flash Image Preview
  • Set up billing (paid model)
  • Price: ~$0.01-0.03 per image

Security settings:

  • Restrict access to the bot (whitelist users)
  • Monitoring API usage
  • Backups of important prompts

System capabilities

AI image processing:

  • Professional lighting - studio lighting from several angles
  • Multiple backgrounds - white, gradient, luxury, pastel
  • Different angles - hero shot, 3/4, macro, flat lay, lifestyle

Quality of results:

  • High resolution - ready for printing and web use
  • Photorealism - indistinguishable from professional photography
  • Save text - all labels and logos remain readable
  • Professional retouching - removing defects without changing the product

Usability:

  • Simple interface - sent a photo to Telegram, got the result
  • Fast processing - 30-60 seconds per generation
  • Multiple options - 4-6 different songs at a time
  • Automated delivery - all results immediately in the chat

System application

For e-commerce:

  • Product photos - professional photos for catalogs
  • A/B testing - different compositions to optimize conversions
  • Saving on a photographer - studio quality without a studio
  • Quick catalog updates - instant processing of new items

For marketing agencies:

  • Customer service - quick creation of promotional materials
  • Prototyping - quick visualization of campaign ideas
  • Presentations - professional mockups for customers
  • Budget savings - lower photography costs

For small businesses:

  • Professional presentation - competition with big players
  • Social media - high-quality content for Instagram/Facebook
  • Marketplaces - Amazon/Ozon compliance
  • Accessibility - professional quality without large investments

The result of the system

What happens is:

  • Professional advertising photos studio quality
  • Multiple song options for different purposes
  • Maintaining product authenticity without distortion
  • Ready-to-use materials for all channels
  • Save time and money on a professional shoot

Performance metrics:

  • Processing time: 30-60 seconds per photo
  • Number of options: 4-6 songs at a time
  • Quality: professional studio
  • Preservation accuracy: 100% compliance with the original
  • Price: ~$0.01-0.03 per processing

Advantages over professional photography:

  • Speed - minutes instead of days to organize a shoot
  • cost - 50-100 times cheaper than a studio
  • Accessibility - works 24/7 from anywhere in the world
  • Consistency - the same high quality every time
  • Variability - lots of styles and compositions at once

System limitations:

  • Dependence on source quality - works better with sharp photos
  • Complex products - may be less accurate for highly detailed items
  • API limits - restrictions on the number of requests per minute
  • cost - Gemini paid model for processing

ROI and business indicators:

  • Time-to-market acceleration - weeks to minutes
  • Increased conversions - professional photos increase sales by 20-40%
  • Scalability - processing hundreds of items per day

This system democratizes access to professional product photography, making studio quality available to any business!

Читайте также

No items found.

write to us and we will show you the way to efficiency