Project

magro

0.01
No release in over a year
Magro is a minimal image processing library for Ruby. Magro uses Numo::NArray arrays as image objects and provides basic image processing functions. Current supporting features are reading and writing JPEG and PNG images, image resizing with bilinear interpolation method, and image filtering.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.9.1
 Project Readme

Magro

Build Status Gem Version BSD 3-Clause License Documentation

Magro is a minimal image processing library in Ruby. Magro uses Numo::NArray arrays as image objects and provides basic image processing functions. Current supporting features are reading and writing JPEG and PNG images, image resizing with bilinear interpolation method, and image filtering.

Installation

Magro dependents libpng and libjpeg to provides functions reading and writing image file. Moreover, it is recommended that using libpng version 1.6 or later.

macOS:

$ brew install libpng libjpeg

Ubuntu (bionic):

$ sudo apt-get install libpng-dev libjpeg-dev

Add this line to your application's Gemfile:

gem 'magro'

And then execute:

$ bundle

Or install it yourself as:

$ gem install magro

If you use homebrew on Apple M1 mac, specify the homebrew installation directory:

$ gem install magro -- --with-opt-dir=/opt/homebrew

Documentation

Usage

> require 'magro'
=> true
> image = Magro::IO.imread('foo.png')
=> Numo::UInt8#shape=[512,512,3]
> grayscale = image.median(axis: 2)
=> Numo::UInt8#shape=[512,512]
> Magro::IO.imsave('foo_gray.png', grayscale)
=> true

Contributing

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

License

The gem is available as open source under the terms of the BSD-3-Clause License.