Mob Ingredient Images
2025-06-12
Benjamin asked if I had any ideas on how to get an image for all ~2,500 ingredients that Mob uses for its recipes. I wondered if I could spin up an AI image generation pipeline that could do it, and in a day I had generated all the images. I'm really happy with the results.
The challenge was getting consistent, professional-quality ingredient photos that look like they belong in a recipe app. I started with Fal.ai—superb and fast and cheap—but transparency handling was a nightmare. I've got a new-found appreciation for what really good background removal apps do; it's not trivial at all. Both DALL-E 2 and 3 generated inconsistent results, so I ultimately landed on GPT-image-1 which while slower and more expensive gave me the control I needed.
To get consistent results you need to be incredibly precise with your prompts. Anything left to chance led to crazy results, so I ended up with 2,625 lines of TypeScript just for prompt engineering. This included 6 ingredient categories (proteins, granular, sauces, powders, herbs, liquids), each with custom presentation rules and viewing angles.
One curious side-effect of aggressive prompting: I got content moderated for a while. OpenAI really doesn't want you shouting at it to generate the most raw chicken flesh possible, so I had to skirt around that little detail.
Once a first pass of images were made, I found I had to tweak and regenerate some—but perhaps only 10% of the total, most were spot on. I built a feedback UI which lets me quickly indicate what was wrong with the image (too few items, too many items, wrong angle, or additional custom instructions) which gets fed back into the generator along with the original instructions.
Ultimately, we now have 4 gigabytes of production-ready images which are going to make it into a future release of the Mob app.
In hindsight, I'd start with GPT-image-1 from day one. The time spent debugging transparency issues with cheaper options wasn't worth the cost savings.