Skip to content

kjunichi/mruby-mrmagick

Repository files navigation

mruby-mrmagick Build Status Build status

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.

install by mrbgems

  • add conf.gem line to build_config.rb
MRuby::Build.new do |conf|

    # ... (snip) ...

    conf.gem :mgem => 'mruby-mrmagick'
end

example

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

See also

License

under the MIT License:

  • see LICENSE file

About

being like rmagick :) in mruby

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published