Generating Dynamic Merch Previews

By Jeffrey Needles

July 21, 2026
Product
Use Cases
Ecommerce

Generating Dynamic Merch Previews

Show Customers Exactly What They Ordered

For a normal product, the catalog photo represents the product. That doesn't really work when you're offering personalized goods.

Once someone puts their name, an inside joke or their favorite quote on a mug, that customized version is what they are buying. A live preview shows it before checkout, but it often disappears as soon as the order is placed.

Then the confirmation email arrives and reduces it to:

Personalized ceramic mug
Color: White
Custom text: Live Laugh Latte
Quantity: 1

All the important details are there, but the thing they just made is gone.

So keep it. When the order is placed, render an image of the finished mug and put that image in the receipt. The customer gets a confirmation that looks like their order, not the blank product they started with.

The Preview Usually Disappears at Checkout

On the product page, the preview can be as interactive as you like. The customer types, changes colors and watches the design update. Then they pay, leave the page and all of that work gets reduced to a few lines of text.

An email cannot run your product customizer. Neither can a packing slip or the order view in your support dashboard. A PNG works in all three.

Generate it when the order is created:

order savedbuild the previewrender a PNGinclude the image URL in the email

That is the whole idea. The browser handles the live preview; the generated image carries the final version beyond checkout.

From Placeholder to Actual Preview

We've all seen this preview:

A white coffee mug with YOUR CUSTOM TEXT HERE printed across it

It is more of an instruction than a preview. The customer still has to imagine what their text will look like.

To make the real version, you need three things you probably already have:

  • The base product photo.
  • The customer's text or artwork.
  • Their selected options, such as color, size and print color.

Use HTML and CSS to position the personalization over the product photo. If it helps, add the selected color, size and quantity around the image too.

You do not need to build a full 3D product renderer. Start with a good mockup for each product style and place the changing parts on top. For a mug, poster, label or card, that can be plenty.

If you need to wrap artwork around a curved object or realistically fold it into fabric, that is a different problem. Make those mockups ahead of time or use a tool built for that job. HTML/CSS to Image is useful for composing the final pieces and turning them into something you can send.

Try it below. Change the words, fonts, sizes and colors and the preview updates as you type. Click Render mug to generate the finished PNG. The tabs at the bottom show the POST request, HTML and CSS behind it.

If the embed does not load, open the mug customizer in a new tab.

Tip

Prefer a visual workflow? You can connect HTML/CSS to Image through Make, Zapier or n8n and pass your order data into the render step without building the whole pipeline yourself.

What the Demo Is Actually Doing

Underneath, the mug preview is just a small 600 × 600 web page.

The page combines the blank product image with the customer's text, font and color choices. Changing a field updates that composition in the browser, which is why the live preview responds immediately.

The three tabs below the demo show the pieces:

  • HTML contains the mug image and the customer's personalization.
  • CSS fixes the canvas at 600 × 600 and puts everything in the right place.
  • POST combines the HTML, CSS and selected fonts into the render request.

When you click Render mug, the demo sends the HTML, CSS and font choices to the HTML/CSS to Image API. The API returns an image URL, which the demo displays with a normal <img> tag in the Rendered image tab.

In a real store, make that API request from your server after the order has been accepted. That keeps your API credentials out of the browser and makes sure the image is built from the values you actually saved.

That distinction is useful: the live preview disappears with the product page, while the rendered PNG can be saved with the order, dropped into an email or passed to your fulfillment team. It is not a manufacturing proof, but it gives the customer, support team and fulfillment team a useful visual reference while the order is being made and shipped.

Render What Was Actually Ordered

One boring but important detail: build the image from the saved order, not by taking a screenshot of whatever happens to be in the browser.

The customer may change the wording right before submitting. Your backend may normalize a value, reject an option or substitute a different variant. The accepted order is the version that matters.

Once payment and validation finish, render from those saved values and keep the image with the order. Now the customer, support and fulfillment are all looking at the same thing.

Keep the written personalization in the email too. The image is easier to scan, but the text is still useful for accessibility, search and copy/paste.

Conclusion

The useful part of a product customizer should not disappear when the customer clicks Buy. Keep the finished preview with the order and you have one image that can follow it into the confirmation email, order history, support dashboard and fulfillment queue.

You can start small: one product, one good mockup and the customization values you already save. Once the order is accepted, build the preview from those values and render it. The same pattern works for shirts, posters, stickers, phone cases, event badges, invitations, labels and plenty of stranger things.

If you can lay out your preview with HTML and CSS, send it to the HTML/CSS to Image API and get back a PNG that you can use anywhere the order goes.

What are you customizing? Share it with us on Twitter. We'd love to see what you are making and how you use the finished previews after checkout.

Get new posts in your inbox

Occasional HTML/CSS to Image updates and posts. No marketing sequences.

Unsubscribe whenever you like.

Have a question?

We'd love to hear about what you're building.

support@htmlcsstoimage.com
Get Started

You'll be up and running in 5 minutes.

Grab an API Key

Keep reading

More posts

View all posts
Get Started Now

NO CREDIT CARD NEEDED. 50 FREE IMAGES EVERY MONTH.