carlstarus/syndikit-pin

Turn a photo and a title into a ready-to-post Pinterest pin. Pure PHP + GD, zero dependencies.

Maintainers

Package info

github.com/carlstarus/syndikit-pin

Homepage

pkg:composer/carlstarus/syndikit-pin

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-08-15 12:08 UTC

This package is auto-updated.

Last update: 2026-08-15 12:39:42 UTC


README

Turn a photo and a title into a ready-to-post Pinterest pin. Pure PHP and GD, zero dependencies.

License: MIT PHP 8.0+ No dependencies

Give it any photo and a headline and it renders a clean 1000 x 1500 pin: the photo fills the top, an accent bar divides the frame, and the title sits on a readable panel with an optional brand line. It also renders a 1.91:1 version for Open Graph and Twitter cards. No design tool, no external API, no monthly fee.

Built and open-sourced by the team behind SyndiKit.

Example output

Example 1000x1500 Pinterest pin    Example 1200x630 featured image

Left: the standard 2:3 pin from make(). Right: the 1.91:1 featured image from makeFeatured(). These are design previews of the layout; drop in real screenshots once you run it with your own photo and font.

Why

Pinterest rewards tall pins with big, readable titles, but making them by hand does not scale. If you publish content and want a pin for every post, you need this in code. This library is the pin renderer approach behind SyndiKit, packaged as a small MIT-licensed class you can drop into any PHP project.

Requirements

  • PHP 8.0 or newer
  • The GD extension with FreeType (for text) and, if you want WebP output, WebP support. GD ships with most PHP builds.

Install

With Composer:

composer require carlstarus/syndikit-pin

Or without Composer, just download src/PinImage.php and require it:

require __DIR__ . '/src/PinImage.php';

Usage

use SyndiKit\Pin\PinImage;

$pin = (new PinImage())
    ->font(__DIR__ . '/fonts/bold.ttf')   // any bold TrueType font
    ->accent(21, 88, 214)                 // your brand color
    ->quality(88);

// Write a 1000 x 1500 pin straight to a file:
// save(photo, title, outputPath, brand)
$pin->save('photo.jpg', 'How to Grow Tomatoes in Pots', 'pin.webp', 'mysite.com');

// Or get the raw bytes to stream or store:
$bytes = $pin->make('photo.jpg', 'How to Grow Tomatoes in Pots', 'mysite.com');
header('Content-Type: image/webp');
echo $bytes;

Featured (1.91:1) rendition for social cards:

$og = $pin->makeFeatured('photo.jpg', 'How to Grow Tomatoes in Pots', 'mysite.com');
file_put_contents('featured.webp', $og);

Configuration

Every setter is chainable and optional.

Method Default What it does
font(string $path) none Bold TrueType font for the title and brand line. Without a font, the pin renders the photo only.
accent(int $r, int $g, int $b) 21, 88, 214 Accent color: the divider, title bar, and brand line.
panel(int $r, int $g, int $b) 20, 27, 38 Panel color behind the title.
textColor(int $r, int $g, int $b) 255, 255, 255 Title text color.
quality(int $q) 88 Output quality 1 to 100 (WebP and JPEG).
format(string $f) webp Output format: webp, png, or jpeg.

Custom canvas size:

// make() and makeFeatured() both accept width and height.
$bytes = $pin->make('photo.jpg', 'Title', 'brand', 1080, 1620);

How it works

  1. The source photo is scaled and center-cropped to cover the image region (no stretching).
  2. The title is auto-fitted: the largest font size that wraps the headline into the allotted lines wins, and anything too long is trimmed with an ellipsis.
  3. A subtle shadow sits behind the text so it stays legible on any photo.
  4. The canvas is encoded to WebP, PNG, or JPEG and returned as bytes.

Errors throw a RuntimeException with a clear message (missing font, unreadable image, no WebP support, and so on), so failures are easy to catch.

From the same team

  • SyndiKit builds and syndicates entire content sites to Pinterest automatically, and themes every pin to your brand.
  • Free Pinterest tools: pin title and description generator, pin maker, keyword tool, bio, board name, and hashtag generators. No signup.

License

MIT. See LICENSE. Use it in anything, commercial or not.