@opmvpc/image-tool
v0.1.4
Published
CLI to batch convert and crop images using sharp
Downloads
286
Readme
Image Tool CLI
Batch converts and crops folders of images. Ships as a global CLI: imgtool.
Install
npm install -g @opmvpc/image-toolUsage
imgtool <inputDir> [outputDir] [options]Options:
--format <webp|png|jpeg|jpg|avif>(default:webp)--quality <1-100>(default:80)--max-width <number>: resize to this width, keeping aspect--max-height <number>: resize to this height, keeping aspect--center-crop <WIDTHxHEIGHT>: crop from center to exact size--overwrite: allow overwriting destination files
If outputDir is omitted, files are written to <inputDir>-out with the chosen format extension.
Examples
Convert a folder to WebP at quality 80:
imgtool ./photos ./photos-webp --format webp --quality 80Resize to max width 1600px, keeping aspect:
imgtool ./raw ./processed --max-width 1600Center-crop to 1200x800:
imgtool ./shots ./shots-cropped --center-crop 1200x800 --format jpeg --quality 90Development
npm install
npm run build
npm testRun the CLI in dev mode:
npm run dev -- --helpRelease & Publish (npm, Trusted Publishing)
Flow tag-based + trusted publishing (pas de NPM_TOKEN) :
- Choisis le bump puis pousse la branche et le tag :
npm version patch # ou minor / major git push origin main --follow-tags - Le tag
vX.Y.Zdéclenche la GitHub Actionrelease.ymlqui :- met npm à jour (>=11.5.1)
- installe (
npm ci) - teste (
npm test) - build (
npm run build) - publie sur npm via OIDC (
npm publish --access public, sans token).
Install global côté utilisateurs:
npm install -g @opmvpc/image-tool
imgtool --help