{
  "id": 10004822,
  "title": "Your link previews are blank because og:image is missing. Here is a stdlib-only Python fix",
  "url": "https://urgent.news/2026/09/26/your-link-previews-are-blank-because-og-image-is-missing-here-is-a",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-26T15:07:11.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/renev3408/your-link-previews-are-blank-because-ogimage-is-missing-here-is-a-stdlib-only-python-fix-o1e"
  },
  "original_language": "en",
  "account": "When you link your product, documentation or personal project to Slack, Discord, X or LinkedIn, the platform generates a preview card using your Open Graph tags. If the og:image tag is absent or points to a default image, the preview appears as a grey box or stock logo. This can negatively impact click-through rates, as users cannot see your actual content. This article outlines three ways to address this issue: a quick check for missing og:image, an all-standard-library Python script to generate a 1280x720 cover image, and how to integrate the image into your webpage.\n\nTo verify if your page has an og:image, run this command: curl -s https://your-site.example/page | grep -io meta[^ ]*og:image[^ ]. Three possible outcomes: no output, indicating the absence of an og:image; a generic URL, such as your host's or storefront's logo; or a unique image specific to your page. Additionally, you can check og:title and og:description in the same manner.\n\nTo create a PNG image using only the Python standard library, refer to the following code snippet:\n\n```python\nimport struct\nimport zlib\n\ndef _chunk(kind, data):\nbody = kind + data\nreturn (struct.pack(I, len(data)) + body + struct.pack(I, zlib.crc32(body) & 0xFFFFFFFF))\n\ndef write_png(path, width, height, rows):\nraw = b'\\x00' + b''.join(rows)\nihdr = struct.pack(IIBBBBB, width, height, 8, 2, 0, 0, 0)\npng = b'\\x89PNG\\r\\n\\x1a\\n' + _chunk(b'IHDR', ihdr) + _chunk(b'IDAT', zlib.compress(raw, 9)) + _chunk(b'IEND', b'')\nwith open(path, 'wb') as f:\nf.write(png)\n```\n\nUse this script to create a diagonal two-color gradient with a solid accent bar, which looks far more engaging than a grey box. The gradient can be customized by adjusting the color values for the colors, c1 and c2, and accent.",
  "summary": "When you paste a link to your product, docs page or side project into Slack, Discord, X or LinkedIn, the platform builds a preview card from your page's Open Graph tags. If og:image is missing or points at a generic platform default, the preview is a grey box or a stock logo. That hurts clicks, and you usually don't notice because you never see your own link the way other people do. This post…",
  "key_points": [
    "Missing og:image tag causes blank link previews",
    "Python script generates 1280x720 cover image",
    "Customizable gradient image improves click-through rates"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}