A few hours ago, Ruby 1.9.3 p125 has bean released. This is the security fix for Ruby OpenSSL. See the page below, for more information:
Of course, it's ready for MinGW. Install operations are as written in phosphorescence: Clean installation Ruby 1.9.3 preview1 with MinGW and MSYS.
Thursday, February 16, 2012
Monday, February 13, 2012
FreeBSD is the easiest way to use Rails3 with nginx
Labels:
FreeBSD,
PC-BSD,
PostgreSQL,
rails3,
Ruby
To use ports on FreeBSD is the easiest way to use Rails3 with nginx.
(1) rubygem-rails port has configuration for rubygem-passenger
(2) rubygem-passenger port has configuration for nginx
(3) nginx port has configuration for many plug-ins.
BTW, rubygem-activerecord port has configuration for PostgreSQL.
So that you can choose BSD-License Friendly products (Ruby 1.9.3, nginx and PostgreSQL) to using Rails3.
(1) rubygem-rails port has configuration for rubygem-passenger
(2) rubygem-passenger port has configuration for nginx
(3) nginx port has configuration for many plug-ins.
BTW, rubygem-activerecord port has configuration for PostgreSQL.
So that you can choose BSD-License Friendly products (Ruby 1.9.3, nginx and PostgreSQL) to using Rails3.
Friday, February 10, 2012
specular reflection with mini_magick (2)
Labels:
ImageMagick,
Ruby
(continued from phosphorescence: specular reflection with mini_magick (1))
"Specular Reflection" consists of 4 operations.
Sample of concrete implementation is below:
These are the output samples.
for white background:
for black background:
"Specular Reflection" consists of 4 operations.
- clone from original image and rotate it
- add transparency to cloned image
- combine original image and cloned one
- resize combined image
- Create canvas with extending the vertical length
- Put the rotated image onto the bottom of this canvas
- Put the original image onto the top of this canvas
Sample of concrete implementation is below:
require 'mini_magick'
original_file = "original.jpg"
image_cloned = MiniMagick::Image.open(original_file)
background_color = 'black' # set background color
COMPOSITE_GRAVITY = 'north'
TRANSPARENCY = '65%'
REFLECTION_FACTOR = Math.sqrt(2)
image_cloned.combine_options do |mogrify|
mogrify.flip
mogrify.fill background_color
mogrify.colorize TRANSPARENCY
end
image_original = MiniMagick::Image.open(original_file)
image_cloned.combine_options(:convert) do |convert|
new_width = image_original[:width]
new_height = (image_original[:height]*REFLECTION_FACTOR).to_i
convert.size "#{new_width}x#{new_height}"
convert.xc background_color
convert.swap '0,1'
convert.gravity COMPOSITE_GRAVITY
convert.geometry "+0+#{image_original[:height]}"
convert.composite
end
image_combined = image_cloned.composite(image_original) do |c|
c.gravity COMPOSITE_GRAVITY
end
output_file = "reflected_#{background_color}.jpg"
image_combined.write output_file
puts "#{output_file} is generated."
These are the output samples.
for white background:
for black background:
Tuesday, February 7, 2012
specular reflection with mini_magick (1)
Labels:
ImageMagick,
Ruby
"Specular Reflection" - a.k.a. "mirror effect" - is the most popular effect for image file to be good-looking. This effect consists of 4 operations.
This ruby script is like below:
You can change the argument(color name) of fill method depending on the background color where you want to put the image file onto. These are original image and rotated and transparent one.
(continue to phosphorescence: specular reflection with mini_magick (2))
- clone from original image and rotate it
- add transparency to cloned image
- combine original image and cloned one
- resize combined image
This ruby script is like below:
require 'mini_magick'
image_original = MiniMagick::Image.open("original.jpg")
image_cloned = image_original.clone
image_cloned.combine_options do |c|
c.flip
c.fill 'white' # set background color
c.colorize '65%'
end
image_cloned.write "cloned_rotate_transparent.jpg"
You can change the argument(color name) of fill method depending on the background color where you want to put the image file onto. These are original image and rotated and transparent one.
(continue to phosphorescence: specular reflection with mini_magick (2))
Saturday, February 4, 2012
JRuby 1.7 becomes 1.9 mode as default mode
Labels:
JRuby
In this issue ticket - http://jira.codehaus.org/browse/JRUBY-6387 - JRuby team surveys that JRuby 1.7 becomes 1.9 mode as default mode or not. And then, decided!!
Subscribe to:
Posts (Atom)







