0.01
No release in over 3 years
Low commit activity in last 3 years
Collection of Active Storage analyzers
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Active Analysis

A collection of active storage analyzers

active-analysis-main

Installation

Add this line to your application's Gemfile:

gem 'active_analysis'

And then execute:

$ bundle install

Usage

Active Analysis automatically replaces all of Rails default analyzers with its own. It will not remove other custom analyzers if you have them. You can also configure which analyzers will be inserted.

Rails.application.configure do |config|
  config.active_analysis.image_library  = :vips # Defaults to the same as active storage
  config.active_analysis.image_analyzer = true  # Defaults to true
  config.active_analysis.audio_analyzer = true  # Defaults to true
  config.active_analysis.pdf_analyzer   = false # Defaults to true
  config.active_analysis.video_analyzer = false # Defaults to true
end

Image

A modification of the original image analyzer and a new analyzer. Requires the ImageMagick system library or the libvips system library.

  • Width (pixels)
  • Height (pixels)
  • Opaque (true if file is opaque, false if not)

An image will be considered opaque if it does not have an alpha channel, or if none of its pixels have an alpha value below the minimum (as defined by the library).

PDF

A new analyzer. Requires the poppler system library.

  • Width (pixels)
  • Height (pixels)
  • Pages

Audio

A new analyzer. Requires the FFmpeg system library.

  • Duration (seconds)
  • Bit Rate (bits/second)

Video

A modification of the original video analyzer. Requires the FFmpeg system library

  • Width (pixels)
  • Height (pixels)
  • Duration (seconds)
  • Angle (degrees)
  • Display aspect ratio
  • Audio (true if file has an audio channel, false if not)
  • Video (true if file has an video channel, false if not)

Addons

Active Analysis allows additional features to be added to the image analyzers through addons. To create an addon simply inherit the Addon class and add it to the addons array in the configuration.

Rails.application.configure do |config|
  config.active_analysis.addons << ActiveAnalysis::Addon::ImageAddon::WhiteBackground
end

The following addons available:

  • ImageAddon::WhiteBackground: An EXPERIMENTAL addon that checks if the image has a white background. Requires both vips and image magick to be installed.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/FestaLab/active_analysis. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the ActiveAnalysis project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.