Overview
Have Codex write and test a script that converts a folder of JPEG images to WebP and plan a staged migration of a large image library, working on a sample copy first and keeping the originals until you approve.
Problem or Objective
- Which agents port code to another language or framework?
- Which agents write or run tests against an application?
More in Coding and Code Review
AI Agents and Models
Tools and Integrations
- Tools
- Codex
- Prerequisites
- Codex access depends on an eligible ChatGPT plan, and local or cloud use needs its own setup; check the help center article for your plan.
How It Works
1. Copy a small, varied sample of your images into a test folder, and note which tables or files refer to image paths. 2. Ask Codex to propose a plan first: which library and quality setting to use, the new file naming, and how references will be updated. Edit the plan. 3. Have Codex write the conversion script so that it never deletes or overwrites an original, writes to a new folder and can be run again safely, then run it on the sample. 4. Compare file sizes and look at a handful of results by eye, including dark and detailed images. Ask Codex to add tests for the naming and the reference update. 5. Test the database change on a copy of the database. Only after you approve do you run the migration on the full library in batches, checking counts after each batch. 6. Delete the originals yourself, much later, once you have a backup.
Implementation Workflow
Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.
- Choose the agentSet up Codex CLI.
- Connect the toolsConnect the tools this workflow relies on: Codex.
- Check the prerequisitesCodex access depends on an eligible ChatGPT plan, and local or cloud use needs its own setup; check the help center article for your plan.
- Gather your detailsCollect what the prompt asks for: Folder with the images, Current image format, Where image paths are stored, Folder for converted images, Small sample for the trial run.
- Run the starter promptPaste the starter prompt below into Codex CLI and adapt it to your case.
- Check against the documentationCompare what you get with the documentation at help.openai.com before you rely on it.
Practical Starter Prompt: Plan a Safe Image Migration
Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].
I want to convert images in [Folder with the images] from [Current image format] to WebP. First, propose a plan: the library and quality setting you would use, the new file naming, and how references in [Where image paths are stored] will be updated. Wait for my approval. Then write a script that never deletes or overwrites originals, writes to [Folder for converted images], can be run again safely, and reports how many files it converted and skipped. Run it only on the sample in [Small sample for the trial run], show me the size comparison, and add tests for the naming and the reference update. Do not touch the full library or any production database without my explicit approval.Approve the plan before the script is written and approve the sample results before the full run. Originals stay in place.
Expected Results and Benefits
This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.
This is a suggested workflow, not a reported outcome. The cited pages say Codex is a coding agent that helps you write, review and ship code, and can take coding tasks from investigating bugs to building features. They do not describe image conversion, so quality, size and speed are things you measure on your own sample.
Limitations and Considerations
A lossy quality setting changes how some images look, so view samples before committing. Test on copies, keep the originals and a database backup, and run the full migration only after you have approved the plan and the sample results. Codex asks for approval before some actions and usage limits vary by plan, so check what runs without a prompt in your setup. Do not point Codex at a production database or give it production credentials. Results depend on your setup and were not independently reproduced by Top 200 Repos.
GitHub Repositories
AI Agent Repository
Source code of the agent that does the work.
Related Videos
About openai/codex
Meet the New Codex CLI (opens in a new tab)
Published by the project’s official channel.
Watch on YouTube (opens in a new tab)Independent creators. Listing a video implies no endorsement, sponsorship or partnership.
Sources
- Using Codex with your ChatGPT plan | OpenAI Help Center (opens in a new tab)
Project documentation · help.openai.com · Undated · Source checked 2 Dec 2026, 13:21 UTC
What this source supports
- This article covers Codex, OpenAI's coding agent that helps you write, review, and ship code.
- Codex Cloud | ChatGPT Learn (opens in a new tab)
Project documentation · developers.openai.com · Undated · Source checked 2 Dec 2026, 13:21 UTC
What this source supports
- Give Codex coding tasks to work through in the cloud, from investigating bugs to building features.
- You can also ask Codex to check out any repository available to Codex through your connected GitHub or GitLab account.
