Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Willi

2 total

rmagick gem install on intel mac

sudo env ARCHFLAGS="-arch i386" gem install rmagick

rmagick test

// Check if rmagick is installed properly by running gem list. Now we are going to test if rmagick works properly. Create a file called test_rmagick.rb, and copy and paste the code below.

#!/usr/bin/env ruby -wKU

# Test if rmagick is working properly or not.
# When run, this file creates a image file 'path.gif' in the same directory.

# the sample code is from http://rmagick.rubyforge.org/portfolio3.html

require 'rubygems'
require 'rmagick' # Don't use a capital 'R'.

canvas = Magick::Image.new(240, 300,
              Magick::HatchFill.new('white','lightcyan2'))
gc = Magick::Draw.new

gc.fill('red')
gc.stroke('blue')
gc.stroke_width(2)
gc.path('M120,150 h-75 a75,75 0 1, 0 75,-75 z')
gc.fill('yellow')
gc.path('M108.5,138.5 v-75 a75,75 0 0,0 -75,75 z')
gc.draw(canvas)

canvas.write('path.gif')
2 total