Wedding Card Editor SDK

Wedding cards with photo-matched accents, in your stationery shop

Wedding stationery shops and photo print services can offer each couple the main colors of their own photo, right in the color picker. Your code can also pick one of those colors and set the names and the frame in it before the couple opens the card.

Available for
Web
Mobile
Desktop
Server

Trusted by 100+
industry leaders

Digitas
Omneky
The Print Bar
Brandwatch
Planoly
HP
Shopify
Reuters
Hootsuite
Semrush
Shutterfly
one.com
Sprout Social
Constant Contact
Spread Group

A crop changes the colors on offer

Image Colors reads the photo as it sits in the frame, so the list follows a crop. When the couple crops in on the roses, the gray drops out and a stronger orange and a peach come in, which keeps the choices close to what the printed card will show.

The bouquet photo on the card before and after cropping in on the roses, each above the Image Colors group of the color picker. Before the crop the five swatches are dark brown, terracotta, pale blue, brown and gray, and after it they are dark brown, a stronger orange, peach, taupe and pale blue

From the couple’s photo to the card’s accent color

Your developers add Image Colors to the web editor as a plugin, so couples pick from their photo’s colors themselves. Your platform also gets those colors in code and can set an accent before the card opens, by a rule of your own. The rule behind these four cards takes the first color that is colorful and dark enough to read on white paper, which the white bouquet doesn’t have.

1. Add the Image Colors plugin to the web editor
import { ImageColorsAssetSource } from "@cesdk/cesdk-js/plugins";
await cesdk.addPlugin(new ImageColorsAssetSource());
The color picker then lists five colors for each photo on the page.
1. Read the photo's five main colors
const [photo] = engine.block.findByName("Photo");
const colors = await engine.block.getDominantColors(photo, { count: 5, ignoreWhite: true });
2. Keep the first one that is colorful and reads on white
const luminance = ({ r, g, b }) => 0.2126 * r ** 2.2 + 0.7152 * g ** 2.2 + 0.0722 * b ** 2.2;
const contrastOnWhite = (c) => 1.05 / (luminance(c) + 0.05);
const chroma = ({ r, g, b }) => Math.max(r, g, b) - Math.min(r, g, b);
const accent = colors.find((c) => contrastOnWhite(c) >= 3 && chroma(c) >= 0.15);
3. Set the names, the divider and the frame in it
if (accent) {
  const color = { r: accent.r, g: accent.g, b: accent.b, a: 1 };
  const [names] = engine.block.findByName("Names");
  engine.block.setTextColor(names, color);
  for (const name of ["Divider", "Diamond"]) {
    const [shape] = engine.block.findByName(name);
    engine.block.setColor(engine.block.getFill(shape), "fill/color/value", color);
  }
  const [frame] = engine.block.findByName("Frame");
  engine.block.setStrokeColor(frame, color);
}
A photo with no such color keeps the template's rose accent.
Four copies of the thank-you card with different photos, each above the five colors the engine read from its photo. The code picked terracotta for the orange roses, a teal blue for a blue bouquet and a soft purple for a field of lavender, and set the names, the divider and the photo frame in that color. A white rose bouquet has no color that passes both checks, so its card keeps near-black names and the rose divider and frame of the template
Get in touch

Color your wedding cards from the couple’s photo

Tell us which wedding cards you print and where the couples’ photos come from, and we’ll get back to you with a custom quote for your use case.

Wedding card FAQs

The wedding invitation editor SDK page goes through the invitation and the rest of the set, gold foil included.

Wedding stationery shops and photo print services embed one so couples can make thank-you cards and other wedding cards on their site, then order the prints in the same place. CE.SDK can also read the colors of each couple's photo and offer them in the color picker.

Up to five per photo, read from the photo as it sits on the card and listed by how much of it each one covers. A crop, a filter or a new photo gives a new set.

The most common color in a photo is often a dark shadow or a background gray. The rule takes the first color that passes both checks, which for the orange roses is the terracotta, second in the list.

A photo of white flowers, or a black-and-white one, has no shade that passes both checks, so the card keeps the template's rose accent, as the white bouquet shows. Couples can still pick any color in the picker by hand.

The engine returns them with the same call on iOS, Android and in Node.js, so your app can apply them or show them as swatches in its own controls. The Image Colors group in the color picker is a plugin for the web editor.