{"slug": "let-codex-claude-code-and-cursor-compress-images-with-pipic", "title": "Let Codex, Claude Code, and Cursor Compress Images with PiPic", "summary": "PiPic has released a Skill that lets coding agents such as Codex, Claude Code, and Cursor compress images directly from natural language commands. The Skill wraps the PiPic CLI, which calls a hosted compression service for PNG, JPEG, WebP, and AVIF files, and returns structured JSON results that agents can interpret reliably. The setup includes a one-time installation and login, after which agents can compress images in place or to a separate directory, with explicit handling of skipped and failed files.", "body_md": "Your coding agent can run a build and edit the code that ships it. Image\n\ncompression often ends with a tool installation, a throwaway script and output the\n\nagent cannot interpret reliably.\n\nPiPic uses a two-part setup instead:\n\n`@pipic/cli`\n\nperforms the image compression.PiPic is not an AI compression model. The agent operates the tool; the hosted PiPic\n\nservice compresses PNG, JPEG, WebP and AVIF files.\n\nRun the setup yourself once:\n\n```\nnpm i -g @pipic/cli\npipic login\n\nnpx skills add PiPic-cc/pipic-cli -g \\\n  -a claude-code \\\n  -a codex \\\n  -a cursor \\\n  -y\n```\n\nThe short form below asks which supported agents should receive the Skill:\n\n```\nnpx skills add PiPic-cc/pipic-cli -g\n```\n\nThe Skill source is public in the\n\n[PiPic CLI repository](https://github.com/PiPic-cc/pipic-cli/blob/main/skills/pipic/SKILL.md).\n\nAfter setup, the task does not need a product name or flags:\n\n```\nCompress the images in ./assets in place.\n```\n\nThe Skill matches image compression, shrinking and optimisation requests. It checks\n\nthat `pipic`\n\nexists and that the machine is signed in. “In place” gives it an\n\nexplicit destination, so the agent runs:\n\n```\npipic ./assets --replace --json\n```\n\nTo preserve the originals, ask for a separate output directory. The agent then uses:\n\n```\npipic ./assets -o ./compressed --json\n```\n\n`--replace`\n\nand `-o`\n\nare mutually exclusive, and one is required. PiPic exits with\n\na usage error before uploading anything when the destination is missing.\n\nWith `--json`\n\n, stdout contains one NDJSON object per file:\n\n```\n{\"file\":\"assets/hero.png\",\"status\":\"ok\",\"before\":2316198,\"after\":723577,\"saved\":1592621}\n```\n\nThose byte counts come from a published PiPic Agent CLI 1.0.6 benchmark run over a\n\nlicensed PNG. They demonstrate the output shape; results vary by image.\n\nEvery row has `file`\n\n, `status`\n\n, `before`\n\n, `after`\n\nand `saved`\n\n. Skipped and failed rows\n\nalso include `error`\n\n. `status`\n\nis always one of:\n\n`ok`\n\n: a smaller result was written.`skipped`\n\n: the original stayed in place, often because the result was larger.`error`\n\n: the file failed and may need attention.The Skill explicitly teaches the agent that `skipped`\n\nis not a failure. Without that\n\nrule, an agent can report an already-optimised image as broken.\n\n| Code | Meaning | What the agent does |\n|---|---|---|\n| 0 | Everything succeeded | Summarises the rows and stops |\n| 1 | Some files failed | Re-runs only paths with `status: \"error\"`\n|\n| 2 | Usage error | Fixes the command instead of repeating it |\n| 3 | Sign-in required | Stops and asks the user to sign in |\n| 4 | Monthly allowance exhausted | Stops; a retry cannot help |\n\nRetry scope matters because every accepted file uses monthly allowance. If two files\n\nfail in a 100-file directory, re-running the entire directory uploads the other 98\n\nagain. The Skill tells the agent to retry only the two failed paths.\n\nIt also tells the agent never to run `pipic login`\n\n. That command opens a browser or\n\nwaits for device-code approval. A coding agent cannot provide the human approval and\n\nshould stop instead of waiting for a timeout.\n\nPiPic Skill is an instruction file. It does not contain an encoder or transport\n\nimage bytes. The CLI resolves files, calls the hosted compression service, writes\n\nsmaller output atomically and returns structured results.\n\nThe remote MCP endpoint is separate and read-only. It helps agents discover the CLI\n\nand HTTP API; images do not move through JSON-RPC.\n\nCLI images leave the machine for processing and are deleted from the server as soon\n\nas compression completes. Teams that require local-only processing should choose a\n\nlocal encoder. PiPic CLI and API offer 100 images per month on Free and 5,000 on Pro;\n\nthe browser compressor remains free, unlimited and account-free.\n\nFull contract: [PiPic Agent CLI documentation](https://pipic.cc/cli)", "url": "https://wpnews.pro/news/let-codex-claude-code-and-cursor-compress-images-with-pipic", "canonical_source": "https://dev.to/zimmer_c/let-codex-claude-code-and-cursor-compress-images-with-pipic-5bim", "published_at": "2026-08-13 09:00:53+00:00", "updated_at": "2026-08-13 09:18:16.737915+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "ai-tools"], "entities": ["PiPic", "Codex", "Claude Code", "Cursor", "PiPic CLI", "PiPic Skill"], "alternates": {"html": "https://wpnews.pro/news/let-codex-claude-code-and-cursor-compress-images-with-pipic", "markdown": "https://wpnews.pro/news/let-codex-claude-code-and-cursor-compress-images-with-pipic.md", "text": "https://wpnews.pro/news/let-codex-claude-code-and-cursor-compress-images-with-pipic.txt", "jsonld": "https://wpnews.pro/news/let-codex-claude-code-and-cursor-compress-images-with-pipic.jsonld"}}