[Ruby] Need urgent help with FreeImage/ImageScience on OS X - will pay!

Ryan Davis ryand-ruby at zenspider.com
Sat Mar 24 12:31:44 PST 2007


On Mar 24, 2007, at 12:08 , John Moody wrote:

> On Mar 24, 2007, at 11:27 AM, Ryan Davis wrote:
>
>> On Mar 24, 2007, at 10:21 , John Moody wrote:
>>
> OS X 10.4.9
> ruby 1.8.5
> compiler is 4.0.1 (if I'm looking in the right place - did I mention
> I'm a Mac newbie?)
> relevant gems:
> 	RubyInline 3.6.2
> 	image_science 1.1.1
>
> Test code:
>
> 	require 'rubygems'
> 	require 'image_science'
>
> 	  ImageScience.with_image "~/desktop/logo.gif" do |img|
> 	    img.thumbnail(50) do |thumb|
> 	      thumb.save "~/desktop/logo-thumb.gif"
> 	    end
> 	  end

Actually, save your money and drive time to Seattle:

require 'rubygems'
require 'image_science'

in_file = File.expand_path "~/Desktop/logo.gif"
out_file = File.expand_path "~/Desktop/logo-thumb.gif"

ImageScience.with_image in_file do |img|
   img.thumbnail(50) do |thumb|
     thumb.save out_file
   end
end

So, 2 things were wrong, you need to use File.expand_path and you  
need to match the case of the directory names (although OSX is a case  
insensitive file system, this is just a good idea).



More information about the Ruby mailing list