Which library/api is used to load and display image using ruby?
How can i do it?
Can anyone post complete code?
···
--
Posted via http://www.ruby-forum.com/.
Which library/api is used to load and display image using ruby?
How can i do it?
Can anyone post complete code?
--
Posted via http://www.ruby-forum.com/.
You have several options. Here's how to do it using RMagick¹:
require 'RMagick'
images = Magick::Image.read(filename)
images[0].display
RMagick depends on ImageMagick² or GraphicsMagick³ being installed on your system.
On 05/03/2012 12:34 PM, gmspro gmspro wrote:
Which library/api is used to load and display image using ruby?
--
Lars Haugseth
[1] http://rmagick.rubyforge.org/
[2] http://www.imagemagick.org/
[3] http://www.graphicsmagick.org/
How would i install rmagic?
gem install rmagic
Error:
Fetching: rmagick-2.13.1.gem ( 81%)
Fetching: rmagick-2.13.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/home/user1/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in
/home/user1/.rvm/bin:/home/user1/.rvm/gems/ruby-1.9.2-p180/bin:/home/user1/.rvm/gems/ruby-1.9.2-p180@global/bin:/home/user1/.rvm/rubies/ruby-1.9.2-p180/bin:bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/user1/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
Gem files will remain installed in
/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/rmagick-2.13.1 for
inspection.
Results logged to
/home/user1/.rvm/gems/ruby-1.9.2-p180/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
--
Posted via http://www.ruby-forum.com/.
gmspro gmspro wrote in post #1059401:
Which library/api is used to load and display image using ruby?
How can i do it?
Can anyone post complete code?
Install gtk2 in system,
Install gem Ruiby,
Then try this :
require 'Ruiby'
Ruiby.app do
stack do
ARGV.each { |fn|
label File.exist?(fn) ?
"#"+fn :
"Oups !! unknown file '#{fn}'"
}
end
end
(label show a image file if args start with #, else args text)
--
Posted via http://www.ruby-forum.com/\.
There is a jruby-specific library which can do this simply:
jruby -rubygems samples/file_view.rb ~/Pictures/hand_sanitizer.jpg
file_view.rb:
require 'image_voodoo'
ImageVoodoo.with_image(ARGV[0]) { |img| img.preview }
Some other samples:
image_voodoo also comes with a command-line util:
jruby -S image_voodoo --preview --flip_vertically --preview
~/Pictures/hand_sanitizer.jpg
image_voodoo --help for other options
-Tom
jruby -S image_voodoo --preview --
On Thu, May 3, 2012 at 5:34 AM, gmspro gmspro <lists@ruby-forum.com> wrote:
Which library/api is used to load and display image using ruby?
How can i do it?
Can anyone post complete code?--
Posted via http://www.ruby-forum.com/\.
--
blog: http://blog.enebo.com twitter: tom_enebo
mail: tom.enebo@gmail.com
gmspro gmspro wrote in post #1059401:
Which library/api is used to load and display image using ruby?
How can i do it?
Can anyone post complete code?
hi there -
how about Shoes? http://shoesrb.com/
green Shoes (https://github.com/ashbb/green_shoes\) is wicked easy to
install and use:
gem install green_shoes
once it's installed, you can just do this:
require 'green_shoes'
Shoes.app do
image 'TradyBlix.png' #(change the filename!)
end
hth-
- j
--
Posted via http://www.ruby-forum.com/\.
The last line of my previous reply contains a pretty big hint.
If you get stuck, there's also this:
http://rmagick.rubyforge.org/install-faq.html
On 05/03/2012 01:45 PM, gmspro gmspro wrote:
How would i install rmagic?
--
Lars Haugseth
For Ruby versions after 1.9.0, I think you need to install rmagick2
instead of rmagick. Someone correct me if I'm mistaken.
On Thu, May 03, 2012 at 08:45:27PM +0900, gmspro gmspro wrote:
How would i install rmagic?
gem install rmagic
--
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]
Note, there is no such gem as "rmagick2". There is just "rmagick",
which happens to have had two major versions, 1.x and 2.x.
-- Matma Rex
2012/5/4 Chad Perrin <code@apotheon.net>:
On Thu, May 03, 2012 at 08:45:27PM +0900, gmspro gmspro wrote:
How would i install rmagic?
gem install rmagic
For Ruby versions after 1.9.0, I think you need to install rmagick2
instead of rmagick. Someone correct me if I'm mistaken.