Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use PowerShell to assemble a design and ImageMagick to render it. A practical workflow is to write an SVG containing your background, text, and shapes, convert it to PNG with magick, then verify and publish the result at a stable HTTPS URL. SVG keeps the design editable; ImageMagick handles raster output and further image processing.

What you need to generate an Open Graph image

An Open Graph (OG) image is the preview image a page can expose in its metadata for link previews. The generation workflow has three parts: define the card’s design and dimensions, render it to an image format, and publish the image where the page’s metadata can point to it. This does not automatically add metadata to your web page; generation and publication are separate steps.

  • PowerShell creates files, escapes text for SVG, and can retrieve remote assets.
  • ImageMagick renders SVG and provides image conversion, resizing, cropping, and other processing operations.
  • A public image URL is needed if social crawlers are to fetch the image referenced by your page.

The example below creates a 1200 × 630 PNG card. That is a conventional starting point, not a universal platform requirement: check the specifications of the platforms you target and adjust the SVG dimensions accordingly.

Install ImageMagick and check that PowerShell can run it

Install ImageMagick from its official download source, then open a new PowerShell session and run:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
magick -version

A version and build-information response indicates that PowerShell found the magick executable. If PowerShell reports that the command is not recognized, the installation directory may not be on PATH, or the terminal may have been opened before installation. Confirm the installation and reopen PowerShell; if necessary, add the ImageMagick installation directory to the Windows PATH and start a fresh session.

ImageMagick’s command-line tools cover drawing and image processing, but this guide uses SVG as the design source rather than building the card from a long chain of drawing commands. Its documentation notes that drawing primitives conform to the Magick Vector Graphics format; its vector-graphics guidance also describes SVG as a useful alternative when hand-authoring MVG would be difficult.

Generate a title card as SVG and render it to PNG

Save the following as generate-og.ps1, then run it from PowerShell with ./generate-og.ps1. It creates a working directory under the current directory, writes an SVG, renders the SVG as PNG, and throws an error if the output file is missing.

$ErrorActionPreference = 'Stop'

$work = Join-Path $PWD 'og-work'
New-Item -ItemType Directory -Force -Path $work | Out-Null
$svgPath = Join-Path $work 'card.svg'
$outPath = Join-Path $work 'card.png'

$title = 'Your article title'
$subtitle = 'A short description of the page'
$titleSvg = [System.Security.SecurityElement]::Escape($title)
$subtitleSvg = [System.Security.SecurityElement]::Escape($subtitle)

@"
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="630" viewBox="0 0 1200 630">
  <rect width="1200" height="630" fill="#111827"/>
  <rect x="72" y="72" width="1056" height="486" rx="28" fill="#1f2937"/>
  <text x="120" y="245" fill="white" font-family="Arial, sans-serif" font-size="64">$titleSvg</text>
  <text x="120" y="330" fill="#93c5fd" font-family="Arial, sans-serif" font-size="34">$subtitleSvg</text>
</svg>
"@ | Set-Content -Encoding utf8 $svgPath

magick $svgPath $outPath
if (-not (Test-Path $outPath)) {
    throw "Image generation failed: $outPath"
}

Write-Output "Created $outPath"

Replace the title and subtitle with the values for the page. The calls to SecurityElement.Escape convert characters such as & and < into safe XML text. Without escaping, titles containing those characters can make the SVG invalid. The fixed viewBox and explicit width and height keep the design canvas predictable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check the rendered file

The script confirms that a file exists, but existence alone does not prove that the image looks right. Open og-work/card.png and inspect the text, margins, contrast, and any clipping. For additional command-line inspection or resizing, use ImageMagick’s options; for example:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
magick identify og-work/card.png
magick og-work/card.png -resize 1200x630 og-work/card-resized.png

Resizing is not a substitute for designing to the intended aspect ratio. A different aspect ratio may require cropping or layout changes, and those choices can cut off text or logos.

Customize the card without making the script fragile

Change color, layout, and typography

Edit the SVG fill colors, text coordinates, font sizes, and shapes. The SVG uses common elements such as rect and text, which are easier to review and maintain than a dense renderer command. Font availability can differ between development machines and CI runners; choose fonts available in the rendering environment, or install the required font as part of the build. Review the generated image in the same environment used for publishing.

Choose PNG, JPEG, or another supported output

The output filename’s extension normally indicates the desired format: for example, card.jpg for JPEG or card.webp for WebP, if the ImageMagick build supports that format. ImageMagick’s format documentation warns that some formats need an explicit format specifier; APNG is one documented example that can require an apng: prefix when reading an image sequence. Do not assume every format has identical input and output behavior—check the format documentation when a conversion fails or produces an unexpected result.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep content safe for XML

Escape dynamic text before inserting it into SVG, as the script does. If you add values that are intended to become SVG markup rather than text, escaping is not enough: validate or construct that markup deliberately instead of treating untrusted input as trusted XML. For long titles, consider wrapping text or reducing font size based on measured layout; the simple example intentionally does not implement automatic line wrapping.

Add a downloaded background or logo

PowerShell’s Invoke-WebRequest sends HTTP and HTTPS requests and can retrieve a remote asset. Download it to the working directory before rendering, then check the response and file before using it. This example saves a background image; replace the URL with an asset you are authorized to use.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
$assetUrl = 'https://example.com/background.jpg'
$assetPath = Join-Path $work 'background.jpg'

$response = Invoke-WebRequest -Uri $assetUrl -OutFile $assetPath
if (-not (Test-Path $assetPath) -or (Get-Item $assetPath).Length -eq 0) {
    throw "Asset download failed or returned an empty file: $assetUrl"
}

A successful HTTP request does not guarantee that the downloaded file is a usable image: a server might return an error page, an access-denied document, or an unexpected format. Confirm that the asset opens and that ImageMagick can read it. Keep remote retrieval out of the rendering path if you need a fully offline, reproducible build; store approved assets with the project or fetch and validate them as a separate build step.

Publish the image and point page metadata to it

After checking the output, deploy it to a stable HTTPS URL that the relevant crawlers can access. Set the page’s Open Graph image metadata to that URL. For example, the HTML head needs an og:image property whose content is the public image URL. This guide generates a file but does not edit your site’s templates, so add or update the metadata in the system that renders the page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Use an absolute, publicly reachable URL rather than a path that only works on your machine.
  • Make sure the deployed file is the version your metadata references; a local PNG that was never uploaded cannot be fetched by a crawler.
  • When replacing an image at the same URL, caching may delay when a service displays the new version. A versioned filename can make the updated asset address explicit.
  • Check the page’s rendered metadata and the deployed image URL independently. A correct image file does not fix a missing or incorrect og:image value.

Automate generation in GitHub Actions

If card content comes from repository files or page data, run the same PowerShell script in CI and publish its output as part of the build. The potatoqualitee/ogimage repository documents a GitHub Action for OG image generation, including PowerShell use on Windows and Ubuntu, configurable filenames, and artifact output. Review that repository’s current action configuration and maintenance status before adding it to a workflow; the exact workflow depends on your repository and deployment process.

For a script-based workflow, keep the inputs and generated files deterministic: pin or otherwise control the rendering environment, use known fonts and assets, and fail the build when rendering does not produce the expected file. A CI artifact is useful for inspection, but it is not automatically the public image referenced by your site. Your deployment step must put the generated image at the URL used in page metadata.

Choose between local rendering, CI, and a hosted generator

Approach Best fit Tradeoff
PowerShell plus local ImageMagick Developers who want direct control over SVG, assets, and output files. Requires local installation and attention to fonts, paths, and assets.
GitHub Action Repository-driven or build-time generation where CI should produce the card. Depends on workflow configuration and the action’s ongoing maintenance; artifacts still need deployment if pages reference them.
Hosted OG-image API Teams that prefer an HTTP-based managed generation workflow. Adds an external service dependency; check its data handling, availability, and pricing terms before relying on it.

OGMagic documents a URL-driven hosted API for generating OG images. Its specific capabilities, terms, and pricing should be checked with the service before adopting it. For a design that is mostly text and shapes, an SVG source plus ImageMagick is a transparent local workflow; for a repository pipeline, CI can make the same generation repeatable. A hosted service is a different operational choice, not a guarantee that the resulting image will meet your design or deployment needs.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API, not a purpose-built OG-card design tool. It can capture a rendered page—such as a web page you have already built to display a card—but it does not replace the SVG-and-ImageMagick method for constructing a custom graphic. One GET request can return a screenshot in PNG, JPEG, or WebP, or a PDF. See the ScreenshotNeo website and the API documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Cookie banners, newsletter popups, and chat widgets are removed before the shot; those cleanup steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. An MCP server offers take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for 1,000 free screenshots a month with no card.

Troubleshooting common failures

magick is not recognized

PowerShell cannot find the ImageMagick executable. Confirm ImageMagick is installed, check that its installation directory is available through PATH, and open a new PowerShell session before retrying magick -version.

The script runs but the output is missing

Run the script from a location where it can create og-work, check that ImageMagick completed without reporting an error, and inspect the SVG file it wrote. The final Test-Path check catches a missing output, but an error from magick may identify the actual cause.

The SVG fails to render or text appears incorrectly

Check that dynamic text was XML-escaped and that the SVG markup remains valid. Confirm the requested font exists in the rendering environment; fonts available on your workstation might not be installed in CI. Open the SVG directly or simplify it to isolate invalid markup from font or renderer issues.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The background download is not an image

Check the requested URL, response, and saved file. A web server can return an HTML error or access page while still completing the request. Validate that the downloaded file is non-empty and readable by ImageMagick before relying on it in the card.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

The output format is wrong or unsupported

Confirm the output extension and the formats supported by the installed ImageMagick build. Some formats require an explicit prefix or special handling; consult the format documentation, particularly when reading image sequences or converting less common formats.

The social preview does not show the new image

Check the page’s rendered og:image metadata and verify that its URL points to the deployed file. Confirm that the URL is reachable over HTTPS without access controls that block crawlers. If you replaced content at a cached URL, use a versioned filename and update the metadata to that address.

Frequently asked questions

Can PowerShell generate the image without ImageMagick?

This workflow uses PowerShell for orchestration and ImageMagick as its renderer. The documented approach here does not provide a PowerShell-only graphics renderer; if avoiding a local renderer is the priority, consider a hosted OG-image API and review its terms.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I use the same script on Windows and Ubuntu?

The PowerShell syntax is cross-platform in principle, but the rendering environment still needs ImageMagick, compatible paths, and the fonts and assets used by the design. Test the script in the operating system and CI image where it will run.

Does generating a PNG make it an Open Graph image automatically?

No. Generation creates the file. Your site must publish it at a crawler-accessible URL and include that URL in its page metadata.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.