0.0
Low commit activity in last 3 years
No release in over a year
Convenient thumbnail resizing using libvips.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.0

Runtime

~> 8.9
 Project Readme

Vips::Thumbnail

An easy to use thumbnail resizer. It's based on libvips so it's faster than everything else.

Development Status

Installation

Add this line to your application's Gemfile:

gem 'vips-thumbnail'

And then execute:

$ bundle

Or install it yourself as:

$ gem install vips-thumbnail

Minimum Version

libvips has some integer truncation issues in versions < 8.4, so you must use a release >= 8.4 otherwise you may experience problems with resize_to_fill.

Usage

It's super easy:

resizer = Vips::Thumbnail::Resizer.new(input_path)
if image = resizer.resize_to_fit([800, 600])
	image.write_to_file(output_path)
else
	# The source image wasn't big enough:
	symlink(input_path, output_path)
end

There are two main methods, #resize_to_fit which preserves aspect ratio, and #resize_to_fill which resizes and crops to fit the desired size if needed.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Released under the MIT license.

Copyright, 2017, by Samuel G. D. Williams.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.