https://github.com/adamcooke/lizard
🏞 Very simple ImageMagick interface for Ruby
https://github.com/adamcooke/lizard
imagemagick ruby wrapper
Last synced: about 1 year ago
JSON representation
🏞 Very simple ImageMagick interface for Ruby
- Host: GitHub
- URL: https://github.com/adamcooke/lizard
- Owner: adamcooke
- License: mit
- Created: 2017-03-10T16:10:07.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-02-19T13:24:09.000Z (over 5 years ago)
- Last Synced: 2025-05-12T15:22:16.993Z (about 1 year ago)
- Topics: imagemagick, ruby, wrapper
- Language: Ruby
- Homepage:
- Size: 7.62 MB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# Lizard - a simple interface to ImageMagick CLI
Lizard is a very simple library that sits atop of a the `convert` and `identify` ImageMagick commands. It's not the fastest image processor in the world but it does it's job. It's job is:
* Reliably identify if a file is an image or not
* Get image information from an image - size, resolution, etc...
* Resize an image to any other size
* Identify the colors in an image and return an array of them
## Installation
```ruby
gem 'lizard', '~> 1.0'
```
## Usage
```ruby
image = Lizard::Image.new(image_data)
image.type #=> "JPEG"
image.width #=> 200
image.height #=> 400
# Resize the image
resized_image = image.resize(200, 200)
resized_image = image.resize(200, 200, :ignore_aspect_ratio)
resized_image = image.resize(200, 200, :fill)
# Crop the image
cropped_image = image.crop(100, 50)
# Get the histogram
image.histogram.colors # => An array of Lizard::Colors
image.histogram.colors.first.red # 23
image.histogram.colors.first.green # 122
image.histogram.colors.first.blue # 200
# Identify if some data is an image or not
Lizard::Image.is_image?(image_data) #=> true/false
```