Automatic Product Image Generation for Social Media

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1All 2062 services
Automatic Product Image Generation for Social Media
Medium
~3-5 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1358
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1250
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    956
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1188
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    929
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    947

Automatic Product Image Generation for Social Media

Every day a marketer spends 20–30 minutes creating one branded image for a new product. Multiply by 100 items — you lose a week. We automate this: the system takes data from the product card (photo, name, price, brand) and generates ready-to-use banners for each social network — Telegram, VK, Instagram, Stories. Result: uniform graphics in seconds, not hours.

How the template generator works

We use the Pillow library (Python) or Sharp (Node.js). Product fields are placed on pre-made templates. Fonts, colors, logo — everything matches the brand book. The generator adapts text to dimensions: if the name is long, the font size is reduced; if the price is with a discount, it's highlighted in yellow.

Example: for an online clothing store, we set up 5 templates for different categories. When a product is added to the CMS, 4 image variants are automatically created — square post, portrait post, story, and Telegram preview. Result: 20 seconds instead of 20 minutes.

from PIL import Image, ImageDraw, ImageFont
import httpx
from io import BytesIO

class ProductBannerGenerator:
    TEMPLATES = {
        'feed':    (1080, 1080),   # Instagram/VK post
        'story':   (1080, 1920),   # Instagram/VK Stories
        'telegram': (1280, 640),   # Telegram preview
    }

    def generate(self, product: dict, format: str = 'feed') -> bytes:
        width, height = self.TEMPLATES[format]
        canvas = Image.new('RGB', (width, height), color='#FFFFFF')
        draw   = ImageDraw.Draw(canvas)
        if product.get('image_url'):
            product_img = self._load_image(product['image_url'])
            product_img = self._fit_image(product_img, (width, int(height * 0.65)))
            canvas.paste(product_img, (0, 0))
        gradient = self._create_gradient((width, int(height * 0.4)), '#000000', alpha_start=0, alpha_end=180)
        canvas.paste(gradient, (0, int(height * 0.6)), mask=gradient)
        font_title = ImageFont.truetype('fonts/Inter-Bold.ttf', size=52)
        font_price = ImageFont.truetype('fonts/Inter-ExtraBold.ttf', size=72)
        font_small = ImageFont.truetype('fonts/Inter-Regular.ttf', size=36)
        y_offset = int(height * 0.68)
        draw.text((60, y_offset), product['name'], font=font_title, fill='white')
        draw.text((60, y_offset + 70), f"{product['price']:,.0f} ₽", font=font_price, fill='#FFD700')
        logo = Image.open('assets/logo.png').resize((200, 60))
        canvas.paste(logo, (width - 220, 20), mask=logo)
        output = BytesIO()
        canvas.save(output, 'JPEG', quality=90)
        return output.getvalue()

    def _load_image(self, url: str) -> Image.Image:
        resp = httpx.get(url, timeout=15)
        return Image.open(BytesIO(resp.content)).convert('RGBA')

Why template generation is better than AI for mass content

Template approach surpasses AI generation in speed and predictability: it's 10 times faster and doesn't require GPU costs. If you need unique graphics for each product (e.g., for a premium brand), we connect Stable Diffusion via Replicate API. The background is generated for the product category, then text is overlaid. This is more expensive but provides variety.

import replicate

def generate_ai_background(product_name: str, category: str) -> str:
    output = replicate.run(
        "stability-ai/stable-diffusion:db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf",
        input={
            "prompt": f"minimalist product photography background for {category}, clean white studio, soft shadows, high-end commercial photo",
            "negative_prompt": "text, watermark, ugly, blurry",
            "width": 1080,
            "height": 1080,
        }
    )
    return output[0]

Which formats and sizes are supported

All popular formats are pre-configured. The system outputs ready files in one package.

Platform Post Stories
Instagram 1080×1080, 1080×1350 1080×1920
VK 1080×1080 1080×1920
Telegram channel 1280×640

Comparison of approaches: template vs AI

Parameter Template AI generation
Speed 1–2 seconds per image 10–30 seconds including queue
Predictability 100% identical result Possible artifacts
Cost CPU only GPU or API (Replicate, Midjourney)
Uniqueness Limited by templates Each image is new

How to avoid common mistakes during automation

  • Incorrect text clipping: if the product name is longer than 200 characters, text may overflow boundaries. Solution: configure automatic wrapping and font size reduction.
  • Ignoring formats: each social network needs its own proportions. The universal 1080×1080 size is not suitable for all — Telegram preview requires 1280×640.
  • Lack of fallback images: if the product has no photo, the generator should use a placeholder with a branded background, otherwise the banner will be empty.

What's included in the work

Turnkey image generator: source code, template setup instructions, repository access, 1 month of support. Additionally, we provide a set of ready templates for typical product categories and instructions for extending them. Pillow documentation recommends using ImageFont.truetype for consistent text rendering across platforms. Integration with any CMS (WordPress, Laravel, Django). We'll estimate the project in 1 day.

How to integrate the generator with the website

  1. Analytics — examine your CMS, product types, current graphics.
  2. Template design — create layouts according to the brand book (3–5 variants).
  3. Generator development — write code using Pillow, configure the API.
  4. Integration — connect to your website or admin panel.
  5. Testing — check on 50+ products, adjust.
  6. Deployment and documentation — provide access, instructions for adding templates.

Timeline

Basic template-based generator with 3 formats — from 4 to 6 business days. With AI background generation — from 7 to 9 days. If a brand book and font set are ready, the timeline reduces by 1–2 days. If no brand book exists, we'll develop templates based on your website or specified color scheme. The exact estimate is provided after analyzing your products and format requirements.

Time savings from automation reach up to 20 hours per week, which at an average designer rate gives budget savings of up to 120,000 ₽ per month. The investment pays off in 2–3 months. We guarantee: over 10 years of development experience, over 50 successful content automation projects. Contact us for a consultation and examples of generation for your niche. Order content automation — reduce publication time by 10 times.

AI Integration: Chatbots, RAG, Semantic Search, Recommendations

In 8 out of 10 projects, an "AI chatbot" turns out to be an expensive wrapper over GPT-4o with a system prompt. Without access to real company data. The user asks "how much does the Premium plan cost?" — the bot hallucinates a price out of thin air. Asks "when will my order arrive?" — gets a polite "contact support." This is not integration — it's imitation. We have implemented RAG solutions in 30+ projects over 5 years: from e-commerce stores to medical portals. We guarantee: useful AI assistance begins where the model reads your documents, not generic answers.

How do we build RAG systems?

Retrieval-Augmented Generation — standard architecture: query → find relevant fragments in a vector DB → insert found context → model response. But the devil is in the implementation details. Let's break down key components that determine quality.

Chunking. Cutting a document into 500-token pieces without regard for structure is a guarantee of losing meaning. If the cut lands in the middle of a paragraph, context breaks. Solution — recursive RecursiveCharacterTextSplitter with 10–15% overlap for documentation. For contracts and instructions, we use a semantic splitter: extract headings, lists, code blocks — each section becomes an independent chunk. Difference in search quality: on a medical project, precision increased from 0.55 to 0.84 just by proper chunking.

Embedding model. For Russian-language texts, intfloat/multilingual-e5-large gives a noticeable accuracy boost over outdated text-embedding-ada-002. In our measurements, NDCG@10 on a test set of 10,000 query-document pairs is 12% higher. OpenAI text-embedding-3-large is good for English content, but for Russian we recommend BAAI/bge-m3 or the mentioned e5-large.

Vector DB. If you already have PostgreSQL — pgvector saves resources. Install extension CREATE EXTENSION vector, add column vector(1024), create HNSW index. On a project with 80,000 support articles, p95 search time was 12 ms. That's enough. For catalogs with millions of items — Qdrant or Weaviate: native hybrid search and sharding out of the box.

What does hybrid search give?

Vector-only search is blind to exact matches: SKUs like "ABC-123", proper names, abbreviations are lost. Full-text-only search doesn't catch synonyms and paraphrasing. Combining via RRF (Reciprocal Rank Fusion) gives the best of both worlds: BM25 + vector search, results merged. In practice, recall@20 increases from 0.65 to 0.92 — the difference is noticeable to the user.

Reranking — final filter: top-20 candidates from hybrid search are run through a cross-encoder cross-encoder/ms-marco-MiniLM-L-6-v2. It adds 50–100 ms to response time, but relevance improves by another 5–10%. Without reranking, the chatbot may show irrelevant documents.

How to implement semantic search on a site?

A search for "comfortable leather armchairs" should find products described as "soft chairs made of natural leather" — ordinary LIKE search cannot do this. Our architecture: when adding a product/post, automatically generate an embedding via multilingual-e5-large, store it in pgvector. On query, embed it with the same model, search nearest neighbors via cosine distance with HNSW index. For a catalog of 100,000 items, index builds in 3 minutes, memory ~400 MB (1536-dimensional vectors). Average search time: 20 ms.

What about recommendation systems?

Collaborative filtering ("users like you bought X") requires history — at least 2–3 months of data with 1000+ active users. For startups or small projects, we use content-based: embedding of current product → search nearest neighbors by cosine similarity. When enough statistics accumulate (usually 15–20 interactions per user), we switch to a hybrid LightFM model. It combines behavior and product features. In our e-commerce project with 50,000 SKUs, the hybrid model increased conversion in the recommendation block by 18% (A/B test lasted 2 weeks).

How does streaming work?

Users shouldn't wait for the entire text to be generated — it kills UX. Server-Sent Events (SSE) is the protocol for token streaming. OpenAI SDK supports stream: true, returning an AsyncIterator. On frontend — Vercel AI SDK (useChat) or custom EventSource. Typical mistake: using WebSocket for unidirectional streaming — SSE is simpler (less code, built-in reconnect). Stack: Node.js + SSE + React.

How to orchestrate agents?

A simple chatbot answers. An agent performs actions: creates a Jira ticket, checks order status in CRM, books a calendar slot. For orchestration, we use LangGraph: state graph where each node is a model or tool call. Vercel AI SDK useChat + tools for Next.js allows adding integration in 10 lines of code. Main challenge — reliability: the model sometimes calls the wrong tool or passes malformed parameters. Protection — Zod schemas for each tool and structured outputs to guarantee JSON.

What does the work include?

Stage Result Duration
Audit of data and business logic Source map, document format, quality assessment 1–2 days
Prototype of RAG or recommendation system Demo with metrics (recall, precision, latency) 1–2 weeks
Integration into existing web application API endpoints, chatbot/search interface 1–2 weeks
A/B testing and optimization Report on metrics (CTR, conversion, hallucination rate) 1 week
Documentation and team training Operations manual, code review 2–3 days

Additionally: we hand over vectorizer source code, monitoring dashboards (Langfuse), admin panel access for knowledge base updates. Post-production support — 1 month free.

What are the timelines?

Task Estimated Time
RAG chatbot based on existing knowledge base 3–6 weeks
Semantic catalog search 2–4 weeks
Recommendation system with A/B testing 6–10 weeks
Multi-agent system with integrations from 8 weeks

Pricing is calculated individually after project discovery. We'll evaluate your project in 1 day. Contact us — we'll show how to turn AI from a toy into a profit-driving tool.