{"content":"# aux4/image\n\nImage manipulation toolkit powered by ImageMagick. Provides commands for resizing, format conversion, compression, metadata inspection, watermarking, metadata stripping, thumbnail generation, and image comparison.\n\n## Installation\n\n``bash\naux4 aux4 pkger install aux4/image\n`\n\nRequires ImageMagick v7+ to be installed. The package will attempt to install it automatically via your system package manager if not found.\n\n## Quick Start\n\n`bash\n# Resize an image\naux4 image resize photo.jpg --size 800x600 --output photo-small.jpg\n\n# Convert to WebP\naux4 image convert photo.jpg --format webp\n\n# Generate a thumbnail\naux4 image thumbnail photo.jpg --size 150x150 --output thumb.jpg\n\n# Get image info\naux4 image info photo.jpg\n`\n\n## Commands\n\n### resize\n\nResize an image by pixel dimensions or percentage.\n\n`bash\naux4 image resize <input> --size <size> --output <file>\n`\n\nSupports absolute dimensions (800x600), single-axis constraints (800x, x600), percentage (50%), and forced exact dimensions (800x600!).\n\n`bash\naux4 image resize photo.jpg --size 800x600 --output photo-resized.jpg\n`\n\n`text\nResized photo.jpg to 800x600 -> photo-resized.jpg\n`\n\n### convert\n\nConvert an image between formats (JPEG, PNG, WebP, TIFF, GIF, BMP).\n\n`bash\naux4 image convert <input> --format <format> [--output <file>]\n`\n\nIf --output is omitted, the output file uses the input name with the new extension.\n\n`bash\naux4 image convert photo.jpg --format webp\n`\n\n`text\nConverted photo.jpg to webp -> photo.webp\n`\n\n### compress\n\nReduce image file size by adjusting quality and stripping metadata.\n\n`bash\naux4 image compress <input> [--quality <1-100>] --output <file>\n`\n\n`bash\naux4 image compress photo.jpg --quality 75 --output photo-compressed.jpg\n`\n\n`text\nCompressed photo.jpg (quality: 75) -> photo-compressed.jpg\n`\n\n### info\n\nDisplay image metadata and properties.\n\n`bash\naux4 image info <input> [--verbose <true|false>]\n`\n\nUse --verbose true for detailed metadata including EXIF data, color space, and image statistics.\n\n`bash\naux4 image info photo.jpg\n`\n\n`text\nphoto.jpg JPEG 4032x3024 4032x3024+0+0 8-bit sRGB 3.2MB 0.000u 0:00.000\n`\n\n### watermark\n\nApply a text watermark to an image.\n\n`bash\naux4 image watermark <input> --text <text> [--gravity <position>] [--color <color>] [--fontSize <size>] [--font <font>] --output <file>\n`\n\nSupports 9 gravity positions (NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast).\n\n`bash\naux4 image watermark photo.jpg --text \"© 2025 MyBrand\" --output photo-branded.jpg\n`\n\n`text\nWatermarked photo.jpg -> photo-branded.jpg\n`\n\n### strip\n\nRemove EXIF and metadata from an image (GPS, camera info, timestamps).\n\n`bash\naux4 image strip <input> [--output <file>]\n`\n\nWithout --output, the input file is modified in place.\n\n`bash\naux4 image strip photo.jpg --output photo-clean.jpg\n`\n\n`text\nStripped metadata from photo.jpg -> photo-clean.jpg\n`\n\n### thumbnail\n\nGenerate a thumbnail with smart center-cropping to exact dimensions.\n\n`bash\naux4 image thumbnail <input> [--size <WxH>] --output <file>\n`\n\nUnlike resize, thumbnail fills the exact target dimensions by cropping from the center.\n\n`bash\naux4 image thumbnail photo.jpg --size 300x200 --output thumb.jpg\n`\n\n`text\nThumbnail photo.jpg (300x200) -> thumb.jpg\n`\n\n### crop\n\nCrop a rectangular region from an image.\n\n`bash\naux4 image crop <input> --geometry <WxH+X+Y> --output <file>\n`\n\nUses ImageMagick geometry format: width x height + X offset + Y offset from the top-left corner.\n\n`bash\naux4 image crop photo.jpg --geometry 300x200+50+100 --output photo-cropped.jpg\n`\n\n`text\nCropped photo.jpg (300x200+50+100) -> photo-cropped.jpg\n`\n\n### grid\n\nOverlay a labeled coordinate grid on an image. Useful for vision-LLM bounding-box prompts.\n\n`bash\naux4 image grid <input> --output <file> [--step <px>] [--labelStep <px>] [--color <color>] [--fontSize <size>] [--font <path>]\n`\n\n`bash\naux4 image grid photo.jpg --step 50 --labelStep 100 --output photo-grid.jpg\n`\n\n`text\nGrid overlay on photo.jpg (step: 50px, labels: 100px) -> photo-grid.jpg\n`\n\n### mask\n\nPaint a solid-color rectangle over a region of an image. Useful for redacting content.\n\n`bash\naux4 image mask <input> --output <file> --geometry <WxH+X+Y> [--color <color>]\n`\n\n`bash\naux4 image mask scan.png --geometry 80x90+20+30 --color white --output scan-redacted.png\n`\n\n`text\nMasked scan.png (80x90+20+30, white) -> scan-redacted.png\n`\n\n### rect\n\nDraw outlined rectangles on an image for visual debugging or annotation.\n\n`bash\naux4 image rect <input> --rect <WxH+X+Y> [--rect ...] --output <file> [--color <color>] [--strokeWidth <px>]\n`\n\nSupports multiple --rect flags to draw several rectangles in one call.\n\n`bash\naux4 image rect photo.jpg --rect 200x100+50+30 --rect 150x80+300+200 --color blue --output annotated.jpg\n`\n\n`text\nDrew rectangles on photo.jpg -> annotated.jpg\n`\n\n### compare\n\nCompare two images and produce a visual diff highlighting differences.\n\n`bash\naux4 image compare <input> --input2 <file> [--output <file>] [--metric <metric>]\n`\n\nSupported metrics: AE, RMSE, PSNR, SSIM, MAE.\n\n`bash\naux4 image compare original.png --input2 modified.png --metric SSIM\n`\n\n`text\nCompared original.png and modified.png (SSIM) -> diff.png\n``\n"}