optimize-images
Skill1 starsChanged 2 months agoMITView on GitHub
Optimize the images in a project with Iminify and write the smaller files back in place. Compresses by default; converts to WebP, AVIF, JPG or PNG, or resizes, when asked. Use when the user asks to compress, optimize, shrink, convert or resize the images in a project, a folder or a set of files.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- Anglesite/anglesite-skillstheir own version, first seen Jul 25, 2026
- mrjonesbot/claude-codetheir own version, first seen Mar 10, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- Anglesite/anglesite-skills★ 4same name
- mrjonesbot/claude-code★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 61
Call create_upload_link with the file's name.
- Very specific: line 63
Keep the upload_id with the file's path.
- Distinctive: line 85
Search the project for each file's name: code, templates, stylesheets, Markdown, config.
- Very specific: line 87
Check that nothing already sits at the new name.
- Distinctive: line 90
When a file's name appears nowhere in the project, the site may build its path at runtime or load it from a CMS.
- Very specific: line 96
Leave committing to the user.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Optimize images
Compress a project's images with Iminify and put the smaller files back where they were. Iminify does the encoding on the user's own account, through the iminify MCP server this plugin connects. This skill is the procedure around it: which files, which settings, and what gets replaced.
It changes files in the user's project, so it confirms before it starts and never overwrites anything that can't be restored.
0. Check the connection and the allowance
The Iminify tools are get_usage, create_upload_link, compress_images and get_image. If they're missing, or a call says the server needs authentication, stop and tell the user how to sign in:
- Claude Code: run
/mcp, pickplugin:iminify:iminify, and press Approve on the Iminify page that opens. - Cursor: open Cursor Settings, then MCP, and press Connect next to
iminify.
Signing in needs an Iminify account with a verified email address. The free plan works.
Then call get_usage and note:
usage.images.remaining: images left today (nullmeans the plan has no daily cap);limits.max_file_size: the largest file the plan takes, in bytes;limits.compressions_per_minute: how many compressions a minute the plan allows.
1. Find the images
Work on exactly what the user named: a file, a folder, a pattern. When they said "the project" or "the site", look through the project. In a git repository, list tracked files with git ls-files, so ignored and generated files are left out. Otherwise, search the folder and skip dependency, build and cache folders: node_modules, vendor, .git, dist, build, public/build, .next, .nuxt, .output, coverage, storage, tmp.
Iminify reads .jpg, .jpeg, .png, .webp, .gif, .heic, .heif, .tif and .tiff. Leave everything else alone, SVG, ICO and AVIF included. Leave out files larger than max_file_size too, and name them in the report.
Show the user what you found before uploading anything: the number of files, their total size, the largest few, and the settings you'll use (step 3). Wait for a yes, unless the user already named the exact files and settings. When there are more files than remaining allows today, say so and offer to start with the largest ones.
2. Make sure the originals can come back
- In a git repository, a file can be restored after it's replaced only when git tracks it and it has no uncommitted changes:
git ls-files --error-unmatch <file>succeeds andgit status --porcelain <file>prints nothing. An ignored file prints nothing too, so the first check is what tells them apart. Name every file that fails either check (untracked, ignored, or changed) and ask before touching it. - Outside git, say that the originals stay in the user's Iminify account (Iminify keeps every upload until the user deletes it, and
get_imagegives a freshoriginal.download_urlat any time), and ask whether to go on.
3. Choose the settings
Send no settings unless the user asked for something. The defaults suit a website: level smart (the lowest quality that still looks like the original), the same format, and the metadata stripped (a photo's orientation is applied to its pixels first, so nothing comes back sideways).
| The user asks for | Send |
| no visible loss at all, "lossless" | level: "lossless" |
| "as small as possible", "aggressive" | level: "ultra" |
| WebP, AVIF, JPG or PNG | format: "webp" (or "avif", "jpg", "png"), and read step 6 first |
| "whatever format is smallest" | format: "auto", and read step 6 first |
| no wider than N pixels | width: N, only for the images wider than N (below) |
| keep camera data, dates or location | keep_metadata: true |
A width or height is exact: Iminify enlarges an image that is smaller than it. For "no wider than 1600", read each image's width first and send width only in a call for the wider images. The rest go in a call without it. To read a width: file prints it for PNG and JPEG, as do ImageMagick's identify and, on macOS, sips -g pixelWidth. In Windows PowerShell, for JPG, PNG, GIF and TIFF (not WebP or HEIC): Add-Type -AssemblyName System.Drawing; ([System.Drawing.Image]::FromFile((Resolve-Path 'path\to\hero.png'))).Width. When a file's width can't be read, don't resize it: leave width out for it and say so in the report. Settings apply to every image in a call, so images that need different settings go in separate calls.
HEIC and TIFF always come back in another format, because Iminify doesn't write either. Treat them as conversions (step 6).
4. Upload, then compress
For each file, one at a time:
- Call
create_upload_linkwith the file's name. The answer has anupload_id, anupload_urland a readycurlcommand. - Send the file straight away, because the link expires within minutes and works once: run the answer's
curlcommand with the file's real path in place of its name. In Windows PowerShell, typecurl.exe: plaincurlthere is an alias forInvoke-WebRequest, which takes different arguments. - Keep the
upload_idwith the file's path.
An uploaded file keeps for about a day, so upload everything first, then call compress_images with upload_ids and the settings. One call takes a limited number of images (compress_images' own description gives the number, and a call over it is refused whole), so send the rest in further calls. The answer's images come back in the order of the upload_ids you sent, less the ones turned down, and each has an id: keep a map from that id to the local path. Anything turned down is in refused, with its source (the upload id), code and message. When nothing at all could be queued, the call comes back as an error that carries the same refused list. Handle each refusal by its code:
rate_limited: the minute's allowance is spent. Waitretry_afterseconds and send those upload ids again. An upload refused this way can still be used.daily_limit_reached: stop. Report what's done, what's left, and the message as it came.- anything else: leave that file alone and give the reason in the report.
5. Wait, then write the results back
Poll get_image for each id, a few seconds apart, until its status is completed, already-optimized, failed or cancelled. Deal with each image as soon as it finishes, because download addresses expire after an hour. Ask get_image again for a fresh one if an address has expired.
completed, the same format as the file, andoptimized.sizesmaller than the file on disk: saveoptimized.download_urlto a temporary file in the same folder, such as.hero.png.iminifybesidehero.png, following redirects and failing on an HTTP error rather than saving the error page. Check that its size in bytes equalsoptimized.size, then move it over the original. If it doesn't, delete the temporary file, askget_imagefor a fresh address and download again.completedin another format: it's a conversion. Follow step 6.already-optimized: Iminify couldn't make the image smaller with these settings. Leave the file as it is and say so plainly, with no saving reported.completedbut not smaller: leave the file as it is.failedorcancelled: leave the file as it is, and pass on thehintif there is one.
6. Conversions change file names
A PNG converted to WebP becomes hero.webp, and everything that loads hero.png still points at the old file. Convert only when the user asked for it. Before writing anything:
- Search the project for each file's name: code, templates, stylesheets, Markdown, config.
- Tell the user what will change: the new files, the references you'll update, and that the old files stay unless they want them removed.
- Check that nothing already sits at the new name. A site often ships
hero.webpbesidehero.pngalready: never overwrite it, and don't convert that original. Name those files in the report instead. - Save each result next to its original under the new extension, checking its size against
optimized.sizeas in step 5, then update the references.
When a file's name appears nowhere in the project, the site may build its path at runtime or load it from a CMS. List those files for the user rather than guessing, and never delete their originals.
7. Report
Finish with a table: each file, its size before and after, and what it saved in bytes and percent, then a line for the total. Under it, list the files left alone and why: already optimized, too large, refused, failed, or skipped at the user's request. Call get_usage again and say how many images today's allowance has left.
Leave committing to the user. The uploads and their results also stay in the user's Iminify account, where the website lists them. Only delete them (delete_image, which can't be undone) when the user asks.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

