Skip to content
CAI
Software that uses CAICheck a score

toy/image_optim

62.0

Adequate · 6 November 2026

2.7k

lines of production code

Ruby

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Added jpegrescan tool with Windows support

The vendor directory now includes the jpegrescan script, which optimizes JPEG files by trying various progressive scan orders to reduce file size. A new jpegrescan.bat wrapper has been added to ensure the tool runs correctly on Windows systems.

vendor · high confidence

Introduce benchmark mode for performance profiling

The library now supports a benchmark mode that measures the time and space savings of individual optimization workers. This is implemented via the new \BenchmarkResult\ class, which records bytes saved and elapsed time per worker, and the \BenchmarkResults\ class in the runner, which aggregates and prints a summary table. Users can enable this via the \--benchmark\ flag, which runs images through the optimization pipeline without modifying them in place, providing performance metrics for each worker.

_lib/image\optim · high confidence

New scripts for worker analysis and README maintenance

Added \script/worker\_analysis\ to evaluate and compare image optimization worker performance using caching and statistical reporting, and \script/update\_worker\_options\_in\_readme\ to automatically generate and update the worker options documentation in the README. A helper script \script/update-rubygems-n-bundler\ was also added to streamline Ruby environment setup across different versions.

script · high confidence

Behavioural changes

Introduce CLI entry point with verbose error reporting

The \bin/image\_optim\ script is introduced as the command-line entry point, delegating argument parsing to \ImageOptim::Runner::OptionParser\ and execution to \ImageOptim::Runner\. A key behavioral change is that when the \--verbose\ flag is used, the tool now outputs the full exception backtrace on failure, whereas previously it likely only showed the error message. It also displays the full version string in verbose mode and aborts with specific messages if no paths are specified or if optimization fails.

bin · high confidence

Major refactoring of ImageOptim core architecture and interface

The lib/image\_optim.rb file has been completely rewritten to introduce a modular architecture, replacing the previous monolithic implementation. This change introduces new configuration options including cache directories, worker digest caching, per-image timeouts, and the ability to skip missing workers or allow lossy optimizations. The core optimization logic is now delegated to dedicated Handler and Cache classes, and the return type for single-image optimization methods has changed to return an OptimizedPath object instead of a simple path. Additionally, the library now supports a broader set of image workers (such as jpeg-recompress, oxipng, and pngquant) and requires Ruby 1.9.3 or higher.

lib · high confidence

Major refactoring of worker architecture and addition of new image optimization tools

The worker implementation has been restructured to use a new \ClassMethods\ module for managing worker registration, option definitions, and initialization, replacing the previous hash-based approach. This refactor introduces a unified \OptionDefinition\ class and explicit \run\_order\ values to control execution sequence. Several new optimization workers have been added, including support for \jpeg-recompress\, \Oxipng\, and \svgo\ (with specific handling for versions 2.x and 3.x). Existing workers have been updated: \Gifsicle\ now runs twice (interlace on/off) for better compression, \Optipng\ and \Pngcrush\ have refined option handling and version checks, and \Jpegtran\ now defaults to using \jpegrescan\. Additionally, \TrueFalseNil\ handling and \allow\_lossy\ options have been standardized across workers to improve consistency and user control over lossy/lossless modes.

_lib/image\optim/worker · high confidence

Refactored CLI option parsing and added glob brace expansion support

The command-line interface now uses a dedicated \OptionParser\ class to handle argument parsing, resulting in improved help text wrapping and indentation that adapts to terminal width. Additionally, a new \GlobHelpers\ module has been introduced to expand curly braces in glob patterns, ensuring compatibility with Ruby versions prior to 2.0 that lack native support for this feature.

_lib/image\optim/runner · high confidence

Refactored binary version detection and validation logic

The binary resolution system has been restructured to improve how external image optimization tools are detected and validated. A new \SimpleVersion\ class enables robust semantic version comparison, while \ComparableCondition\ allows for cleaner, declarative version checks. The \Bin\ class now centralizes version detection for tools like pngcrush, pngquant, optipng, and jpeg-recompress, and enforces strict failure or warning conditions based on specific version ranges (e.g., blacklisting pngcrush 1.7.80 due to color loss). This refactoring ensures that incompatible or buggy tool versions are caught early, providing clearer error messages and preventing silent corruption of optimized images.

_lib/image\_optim/bin\resolver · high confidence

Test coverage

Added test coverage for GlobHelpers and OptionParser; Added test coverage for core image optimization components; Added test coverage for image optimization workers; Added test fixture for images with fully transparent pixels; Added test fixtures for image processing specs; Added test image generation script for orientation tests; Added test image generation script for quantization specs; Added tests for bin\_resolver version comparison logic; Initial test suite for ImageOptim core functionality.

Dependencies

Added jQuery 2.1.3 library to script/template directory

The script/template directory now includes the jQuery 2.1.3 minified library (jquery-2.1.3.min.js), making this version of jQuery available for use in the application's scripts and templates.

script/template · high confidence

Update to version 0.32.0 with Ruby 4 support and modernized dependencies

This release updates the gem to version 0.32.0 and introduces support for Ruby 4 by conditionally requiring the 'logger' gem in the Gemfile. It adds SVG optimization support via the 'svgo' worker and updates the summary to reflect additional supported utilities like jhead, jpeg-recompress, and oxipng. Dependency constraints have been refreshed, including 'fspath' \~\> 3.0, 'image\_size' \>= 1.5, and 'exifr' \~\> 1.2, while development dependencies now include 'rubocop' \~\> 1.90 and 'rubocop-rspec' \~\> 2.0 for Ruby 2.7+ environments. The gemspec also adds metadata URIs and a post-install message noting that Rails integration has been extracted to a separate gem.

(dependencies) · high confidence

Housekeeping

Initial repository setup and configuration

The repository is initialized with essential configuration files including a RuboCop style guide (.rubocop.yml), a pre-commit hook definition (.pre-commit-hooks.yaml) for the image\_optim command, and a Dockerfile.test for building test environments. Documentation is established with a comprehensive README.markdown, a CHANGELOG.markdown starting at v0.32.0, and CONTRIBUTING.markdown guidelines. The project also includes a .gitignore to manage build artifacts and a LICENSE.txt with updated copyright years.

(repo-wide) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 52 → 62 (+10.0)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 67 → 67 (+0.0)
  • Architecture 96 → 96 (+0.0)
  • Maturity 37 → 59 (+22.6)
  • Readiness 70 → 70 (+0.0)
  • Security 80 → 75 (-4.6)
  • Accessibility 58 → 58 (+0.0)

Resolved (3)

  • Ambiguous intent. It is unclear if full_version returns a more detailed string (e.g., including dependencies) or if it is a duplicate of version. If they return the same data, one is redundant.
  • Redundant naming convention for identical operations. In Ruby, the ! suffix typically implies a destructive or exception-raising variant, but here both methods appear to perform the same optimization logic on the same input type. Without distinct behavioral differences (e.g., one raising on failure, one returning nil), this creates API confusion.
  • Same redundancy issue as above, but for the batch processing method. The ! variant is likely a duplicate or a confusingly named strict variant.

Changes since last survey

  • 2 commits — 2 feature/other, 0 fixes

By area

  • .github/workflows — 2 commits

Notable commits

  • change: Bump the non-major group with 2 updates (#248)
  • change: Bump the non-major group with 3 updates (#249)

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

toy/image_optim was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 6 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 592a9b3ee7cadf8edf77505023482b6c5f1b80ba — the exact code this score is about.
  • Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.