Jpeg
A libjpeg wrapper for ruby
Installation
Add this line to your application's Gemfile:
gem 'jpeg'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jpeg
Usage
- get size
- get color_info
jpeg = Jpeg.open('path/to/file')
jpeg.size # => [1920, 1080]
jpeg.width # => 1920
jpeg.height # => 1080
jpeg.color_info # => :rgb or :gray
jpeg.rgb? # => true
jpeg.gray? # => false
dot = jpeg.at(1920, 500) #=> <Jpeg::Color r=0x00 g=0xaa b=0xff>
dot.rgb #=> [0, 170, 255]
dot.to_s #=> '#00aaff'
Contributing
- Fork it ( https://github.com/[my-github-username]/jpeg/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request