2
5 Comments

Claude can't generate images. So I made it write code that does — and for my use case it beats GPT Image 2

Here's a thing people don't realize about Claude: it can't generate images.
There's No ChatGPT, no Gemini Nano Banan, no "make me a picture" button.

When I started, I saw that as a gap.
Now it's my favorite part of the workflow.

I build blog covers, infographics, and social creatives across a handful of brands. Early on I tried the obvious route the image models.

And they kept failing at the exact things that matter for marketing assets:

  • Text comes out garbled or misspelled
    (a dealbreaker when the image IS a headline).

  • Brand colors drift — you ask for one hex, you get a vibe.

  • Nothing is reproducible. Regenerate and it's a different image.
    Want the same layout with new copy? Good luck.

So I flipped it. Instead of asking Claude to draw an image, I have it write code that builds one — SVG for the layout, a small script to inject the content, then a headless browser screenshots it to a pixel-perfect PNG.

The difference is night and day:

  • Text is exact: it's real rendered type, not a hallucinated guess.
  • Brand colors are exact: they're literally the hex codes.
  • It's reproducible and templated: one frame, infinite posts. New blog? Swap the title and the data, re-run, done in seconds.
  • It's version-controlled: my designs live in git like code, not in a folder of one-off PNGs.

I went from "AI can't design for me" to shipping consistent, on-brand images faster than I ever did in a design tool — because I stopped treating design as a drawing problem and started treating it as a rendering problem.

The lesson I keep relearning: a tool's "missing feature" is sometimes pointing you at a better workflow. Image models are magic for art. For brand assets that need precision, code quietly wins.

Question for the room: anyone else generating visual assets with code instead of image models? Curious what you're rendering — and where it breaks down at scale.

If you want the proof, visit:

RankInAiOverview : https://www.rankinaioverview.com/blog?utm_source=indiehackers&utm_medium=social&utm_campaign=build-in-public&utm_content=images-from-code

GetRankOnMap : https://www.getrankonmap.com/blog?utm_source=indiehackers&utm_medium=social&utm_campaign=build-in-public&utm_content=images-from-code

P.S. — that whole grid of images above? Yeah… also made this way. Claude wrote the code, a headless browser took the screenshot. 😎

on July 3, 2026
  1. 1

    Cool project, Nishchay! On using code to generate images instead of relying on image models — finding unconventional solutions that outperform mainstream options is exactly the mindset more builders need. I've been tackling capability gaps in existing AI tools and your approach is interesting. The reproducibility and version control aspects are game-changers.

    1. 1

      Indeed - problem solving stands as the 1st identifier of a builder!

  2. 1

    Really liked your approach of treating it as a rendering problem instead of an image generation problem. Do you use any other AI tools alongside Claude in that workflow?

    1. 1

      Glad that you liked the non-traditional way of solving that problem, no as of low it has been to extend of internalised that I have to dig deep into shaping it in a way it can turn agentic and llm agnostic but then costing came into picture - so no as of now its claude code at its core!

      1. 1

        Hmm makes sense.