ImageMagick binding for mruby.
I don't know or use the whole ImageMagick library. I have deliberately let some modules out of these bindings in order to focus on parts I understand and/or have a need for.
- add conf.gem line to
build_config.rb
MRuby::Build.new do |conf|
# ... (snip) ...
conf.gem :mgem => 'mruby-mrmagick'
end
img = Mrmagick::ImageList.new("sample.png") # read image file.
new_img = img.blur_image(0.0, 8.0) # returns new image which bluerd.
new_img.write("blur.jpg")
img = Mrmagick::ImageList.new("sample.jpg") # read image file.
new_img = img.scale(0.5) # returns new image which scaled.
new_img.write("half.png")
img = Mrmagick::ImageList.new("sample.png") # read image file.
img2 = img.blur_image(0.0, 8.0) # returns new image which bluerd.
img3 = img2.scale(4) # returns new image which scaled.
img3.write("blur_x4.jpg")
img = Mrmagick::ImageList.new("sample.jpg") # read image file.
img.get_exif_by_entry('GPSLatitude')
img = Mrmagick::ImageList.new("sample.jpg") # read image file.
img2 = img.blur_image(0.0, 8.0) # returns new image which bluerd.
File.open("blob.jpg", "wb") {|f|
f.print img2.to_blob
}
img = Mrmagick::ImageList.new("sample_with_exif.jpg")
img.orientation # => 2
img = img.auto_orient
img.write("sample_ao.jpg")
img = Mrmagick::ImageList.new("sample_ao.jpg")
img.orientation # => 1
- How to build one binary using with mruby cli
- How to build h2o with mruby-mrmagick
- Rubyist Magazine - RedDotRubyConf 2015 レポート
- ngx_mrubyを使った簡単な画像変換サーバを数分で実装してみた - 人間とウェブの未来
under the MIT License:
- see LICENSE file