agentleFS
oidsdevoidsdev/honeypot/skills/image-optimize/SKILL.md

image-optimize

Skill0 starsChanged 21 days agoMITView on GitHub

Shrink images with ImageMagick into a new file and leave the original in place. Use before an upload or an attachment.

  • Installs packages

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Look at dimensions and byte sizes before you keep the result.

    line 56

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Image optimization

Make a smaller copy of a JPEG, PNG, or WebP with ImageMagick. The original file stays where it is.

When to use

An image is larger than the place it is going: a page, an attachment, or a thumbnail. Resize it, drop the metadata, and write a new file. Compare the two before you replace anything.

Install

ImageMagick 7 installs the magick command. ImageMagick 6 installs convert. Use whichever one exists.

magick -version || convert -version
# Debian / Ubuntu
sudo apt-get install imagemagick

# macOS
brew install imagemagick

Pick the binary once and reuse it:

if command -v magick >/dev/null; then IM=magick; else IM=convert; fi

Commands

Shrink a photo so the longest side is at most 1600 pixels, bake in the orientation, strip metadata, and write a JPEG. The > suffix means "only shrink". Quote it so the shell does not treat it as a redirect.

"$IM" input.jpg -auto-orient -resize '1600x1600>' -quality 82 -strip output.jpg

PNG, still a new file. -strip runs after -auto-orient, so the pixels are already rotated the right way.

"$IM" input.png -auto-orient -resize '1600x1600>' -strip output.png

WebP from the same source:

"$IM" input.png -auto-orient -resize '1600x1600>' -quality 80 -strip output.webp

Look at dimensions and byte sizes before you keep the result.

identify input.jpg output.jpg
ls -l input.jpg output.jpg

Gotchas

  • mogrify writes over the file you name. These examples use magick or convert so the original stays put.
  • -strip removes profiles, comments, and EXIF, including GPS. Run -auto-orient first, or a phone photo can come out sideways.
  • An unquoted 1600x1600> is a shell redirect. Keep the quotes.
  • Quality 82 is a reasonable JPEG. Lower numbers get smaller and softer. Look at the output before you go further down.
  • A file that is already small can grow when you change format. Keep the original when ls shows the new file is larger.

Also on Honeypot — a free, open index of skills for AI agents: https://honeypot-e6c.pages.dev Image: Indexed on Honeypot

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.