Ruby can't see RMagick installed from gem on FC4

I’m planning on using RMagick to do thumbnails for a Rails project.

Installed RMagick using ‘gem install rmagick’

Here are last few lines…

gcc -fPIC -Wall -g -I. -I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick
-DRUBY_VERSION=0x184 -I/usr/include -c rmfill.c
gcc -fPIC -Wall -g -I. -I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick
-DRUBY_VERSION=0x184 -I/usr/include -c rminfo.c
gcc -fPIC -Wall -g -I. -I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick
-DRUBY_VERSION=0x184 -I/usr/include -c rmmain.c
gcc -shared -L/usr/lib -lfreetype -lz -L/usr/lib -L"/usr/lib" -o
RMagick.so rmilist.o rmdraw.o rmutil.o rmimage.o rmfill.o rminfo.o
rmmain.o -lMagick -llcms -ltiff -lfreetype -ljpeg -lgs -lXext -lSM -lICE
-lX11 -lXt -lbz2 -lz -lpthread -lm -lpthread -lruby -ldl -lcrypt -lm
-lc
make[1]: Leaving directory
`/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick’
setup.rb: entering post-setup phase…
post-setup.rb: setting up documentation…
/usr/bin/ruby -I /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./lib -I
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./ext/RMagick Adispatch.rb
/usr/bin/ruby -I /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./lib -I
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./ext/RMagick
InitialCoords.rb
post-setup.rb: InitialCoords.rb example returned error code 256
/usr/bin/ruby -I /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./lib -I
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./ext/RMagick NewCoordSys.rb
post-setup.rb: NewCoordSys.rb example returned error code 256
/usr/bin/ruby -I /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./lib -I
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./ext/RMagick OrigCoordSys.rb
post-setup.rb: OrigCoordSys.rb example returned error code 256
/usr/bin/ruby -I /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./lib -I
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./ext/RMagick
PreserveAspectRatio.rb
post-setup.rb: PreserveAspectRatio.rb example returned error code 256
/usr/bin/ruby -I /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./lib -I
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./ext/RMagick RotateScale.rb
post-setup.rb: RotateScale.rb example returned error code 256

make install
/usr/bin/ruby setup.rb install

post-install.rb: installing documentation…
Successfully installed rmagick-1.13.0

‘post-setup.rb’ error codes worry me…

Tried using it anyway as installation reported as ‘successful’ anyway.

Rails complained about not finding the methods.

tried testing the “require ‘RMagick’” in irb.


LoadError: no such file to load – RMagick
from (irb):1:in `require’
from (irb):1

tried the sample script from the ‘Users Guide’

require ‘RMagick’
include Magick

cat = ImageList.new(“Cheetah.jpg”)
cat.display
exit

Results:

Rmagicktest.rb:1:in `require’: no such file to load – RMagick
(LoadError)
from Rmagicktest.rb:1

Checked locations of Rmagick.so and libMagick.so


locate RMagick.so
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick/RMagick.so
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/lib/RMagick.so
locate libMagick.so
/usr/lib/libMagick.so
/usr/lib/libMagick.so.9
/usr/lib/libMagick.so.9.0.4

No 'usr/local/lib/ to worry about…

Any ideas on where to look/ how to fix?

Thanks,

Lance F. Squire

Lance S. wrote:


LoadError: no such file to load – RMagick
from (irb):1:in `require’
from (irb):1

tried the sample script from the ‘Users Guide’

require ‘RMagick’
include Magick

cat = ImageList.new(“Cheetah.jpg”)
cat.display
exit

Results:

Rmagicktest.rb:1:in `require’: no such file to load – RMagick
(LoadError)
from Rmagicktest.rb:1

Checked locations of Rmagick.so and libMagick.so


locate RMagick.so
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick/RMagick.so
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/lib/RMagick.so
locate libMagick.so
/usr/lib/libMagick.so
/usr/lib/libMagick.so.9
/usr/lib/libMagick.so.9.0.4

No 'usr/local/lib/ to worry about…

Any ideas on where to look/ how to fix?

Thanks,

Lance F. Squire

Try to run following line
ruby -rrubygems -e “require ‘RMagick’; puts Magick::Long_version;”
what do you see??

Also you could read this article - you could find some interesting
things about RMagick

http://blog.pomozov.info/posts/adventure-with-rmagick-and-mongrel.html

Anatol P. wrote:

Try to run following line
ruby -rrubygems -e “require ‘RMagick’; puts Magick::Long_version;”
what do you see??

Also you could read this article - you could find some interesting
things about RMagick

http://blog.pomozov.info/posts/adventure-with-rmagick-and-mongrel.html

$ ruby -rrubygems -e “require ‘RMagick’; puts Magick::Long_version;”
This is RMagick 1.13.0 ($Date: 2006/06/26 23:32:37 $) Copyright (C) 2006
by Timothy P. Hunter
Built with ImageMagick 6.2.5 05/25/06 Q16
file:/usr/share/ImageMagick-6.2.5/doc/index.html
Built for ruby 1.8.4 (2005-12-24) [i386-linux]
Web page: http://rmagick.rubyforge.org
Email: [email protected]


Interesting… That seems to work…

Reading website…

Lance S. wrote:

Anatol P. wrote:

Try to run following line
ruby -rrubygems -e “require ‘RMagick’; puts Magick::Long_version;”
what do you see??

Also you could read this article - you could find some interesting
things about RMagick

http://blog.pomozov.info/posts/adventure-with-rmagick-and-mongrel.html

$ ruby -rrubygems -e “require ‘RMagick’; puts Magick::Long_version;”
This is RMagick 1.13.0 ($Date: 2006/06/26 23:32:37 $) Copyright (C) 2006
by Timothy P. Hunter
Built with ImageMagick 6.2.5 05/25/06 Q16
file:/usr/share/ImageMagick-6.2.5/doc/index.html
Built for ruby 1.8.4 (2005-12-24) [i386-linux]
Web page: http://rmagick.rubyforge.org
Email: [email protected]


Interesting… That seems to work…

Reading website…

Add explicit
require ‘rebygems’
to your code then

require ‘rubygems’
require ‘RMagick’
include Magick
cat = ImageList.new(“Cheetah.jpg”)
cat.display
exit

Anatol P. wrote:

Also you could read this article - you could find some interesting
things about RMagick

http://blog.pomozov.info/posts/adventure-with-rmagick-and-mongrel.html

Um… This is FC4 no sudo to worry about (there is a root account to
work from)

libs ARN’T in ‘usr/local/lib’ they are in ‘usr/lib’ (see top)

Running the irb or ruby tests above produce the same results under root.

Still stumped…

Lance

On Thu, 3 Aug 2006, Lance S. wrote:

Anatol P. wrote:

Also you could read this article - you could find some interesting
things about RMagick

http://blog.pomozov.info/posts/adventure-with-rmagick-and-mongrel.html

Um… This is FC4 no sudo to worry about (there is a root account to
work from)

you should never, never compile as root. fyi.

libs ARN’T in ‘usr/local/lib’ they are in ‘usr/lib’ (see top)

and do you have ld.so configured to look there?

-a

Lance S. wrote:

I’m planning on using RMagick to do thumbnails for a Rails project.

Installed RMagick using ‘gem install rmagick’

> locate RMagick.so > Any ideas on where to look/ how to fix? > > Thanks, > > Lance F. Squire >

If you are using a library installed with gems, you will need to

require ‘rubygems’

first. Give that a try.

-Justin

Justin C. wrote:

If you are using a library installed with gems, you will need to

require ‘rubygems’

first. Give that a try.

-Justin

This dose make the test code from the ‘Users guide’ work.

Though you would think they would have included it…

Lance

unknown wrote:

you should never, never compile as root. fyi.

Yes, but I must ‘su’ for the ‘gem install rmagick’ to work properly.

libs ARN’T in ‘usr/local/lib’ they are in ‘usr/lib’ (see top)

and do you have ld.so configured to look there?

Well, as Rails is working properly, and was installed the same way, I
presume that ld.so is pointing to ‘usr/lib’

Can’t find relevent ld.so to check…

locate ld.so

/etc/ld.so.cache
/etc/ld.so.conf
/etc/ld.so.conf.d
/etc/ld.so.conf.d/mysql-i386.conf
/etc/ld.so.conf.d/qt-i386.conf
/usr/lib/librpmbuild.so
/usr/lib/kde3/kded_kssld.so
/usr/share/doc/man-pages-ja-20060115/translation_lists/ld.so.translation_list
/usr/share/man/ja/man8/ld.so.8.gz
/usr/share/man/man8/ld.so.8.gz

Lance

I usually use require_gem to get a gem into Rails:

require ‘rubygems’
require_gem ‘rmagick’
include RMagick

HTH,
Jeff

Justin C. wrote:

require ‘rubygems’

first. Give that a try.

-Justin

Unfortunatly, no love from rails…

Lance

Jeff Everett wrote:

I usually use require_gem to get a gem into Rails:

require ‘rubygems’
require_gem ‘rmagick’
include RMagick

HTH,
Jeff

This at least gives me a new error message.


uninitialized constant RMagick
.
.
.
This error occured while loading the following files:
r_magick.rb


Previous rails error was:


undefined method `columns’ for #Array:0xb791c810

can’t ‘locate’ a r_magick.rb on my system…

Lance

On Fri, 4 Aug 2006, Lance S. wrote:

unknown wrote:

you should never, never compile as root. fyi.

Yes, but I must ‘su’ for the ‘gem install rmagick’ to work properly.

that means you are compiling as root. if the installs uses non-standard
library paths (LD_RUN_PATH or -r switch to ld.so) they will then fail at
runtime as doing this as root is silently ignored.

libs ARN’T in ‘usr/local/lib’ they are in ‘usr/lib’ (see top)

and do you have ld.so configured to look there?

Well, as Rails is working properly, and was installed the same way, I
presume that ld.so is pointing to ‘usr/lib’

rails doesn’t require a properly configured ld.so since it uses now
shared
libs

/usr/share/doc/man-pages-ja-20060115/translation_lists/ld.so.translation_list
/usr/share/man/ja/man8/ld.so.8.gz
/usr/share/man/man8/ld.so.8.gz

to check - find the ‘*.so’ created by the ‘gem instann rmagick’ command,
then
do something like

ldd RMagick.so

for instance

jib:~ > ldd
/dmsp/reference/ruby-1.8.1/lib/ruby/site_ruby/1.8/i686-linux/RMagick.so
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x0086e000)
libz.so.1 => /usr/lib/libz.so.1 (0x002d6000)
libMagick.so.6 => /dmsp/reference/lib/libMagick.so.6
(0x00c1f000)
libtiff.so.3 => /dmsp/reference/lib/libtiff.so.3 (0x00e82000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x0068f000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x00ad4000)
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x00578000)
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x00111000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x00128000)
libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x009c1000)
libbz2.so.1 => /usr/lib/libbz2.so.1 (0x00e08000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00207000)
libm.so.6 => /lib/tls/libm.so.6 (0x0079a000)
libdl.so.2 => /lib/libdl.so.2 (0x003f7000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x0053a000)
libc.so.6 => /lib/tls/libc.so.6 (0x00ae2000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00506000)

-a

On Fri, 4 Aug 2006, Lance S. wrote:

Sorry for longish posts…

no prob.

it looks RMagick compiled ok - otherwise you wouldn’t have an so…

what do these commands do for you

harp:~ > ruby -r rubygems -e’ require “RMagick”; p Magick ’
Magick

if that doesn’t work try

harp:~ > LD_LIBRARY_PATH=/usr/lib ruby -r rubygems -e’ require
“RMagick”; p Magick ’
Magick

??

-a

On Fri, 4 Aug 2006, Lance S. wrote:

This at least gives me a new error message.


uninitialized constant RMagick

ah.

that is your problem

it’s Magick - not RMagick!

-a

unknown wrote:

Yes, but I must ‘su’ for the ‘gem install rmagick’ to work properly.

that means you are compiling as root. if the installs uses non-standard
library paths (LD_RUN_PATH or -r switch to ld.so) they will then fail at
runtime as doing this as root is silently ignored.

should I then remove the package and again attempt to install as user?

(Thought I installed rails as user, but could not get rmagick to install
that way…)

to check - find the ‘*.so’ created by the ‘gem instann rmagick’ command,
then

found:

]$ locate RMagick.so
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick/RMagick.so
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/lib/RMagick.so

do something like

ldd RMagick.so

$ ldd /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/lib/RMagick.so
linux-gate.so.1 => (0x00168000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00385000)
libz.so.1 => /usr/lib/libz.so.1 (0x00fe5000)
libMagick.so.9 => /usr/lib/libMagick.so.9 (0x00ba8000)
liblcms.so.1 => /usr/lib/liblcms.so.1 (0x00e55000)
libtiff.so.3 => /usr/lib/libtiff.so.3 (0x00111000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00184000)
libgs.so.8 => /usr/lib/libgs.so.8 (0x00ff8000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x001a6000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x007b1000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x006ce000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x001b6000)
libXt.so.6 => /usr/lib/libXt.so.6 (0x00ef9000)
libbz2.so.1 => /usr/lib/libbz2.so.1 (0x002b3000)
libpthread.so.0 => /lib/libpthread.so.0 (0x002c3000)
libm.so.6 => /lib/libm.so.6 (0x002d7000)
libruby.so.1.8 => /usr/lib/libruby.so.1.8 (0x003f3000)
libdl.so.2 => /lib/libdl.so.2 (0x002fc000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x00889000)
libc.so.6 => /lib/libc.so.6 (0x004ed000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00300000)
libcupsimage.so.2 => /usr/lib/libcupsimage.so.2 (0x00328000)
libcups.so.2 => /usr/lib/libcups.so.2 (0x0075a000)
libssl.so.6 => /lib/libssl.so.6 (0x0033f000)
libcrypto.so.6 => /lib/libcrypto.so.6 (0x008b7000)
libnsl.so.1 => /lib/libnsl.so.1 (0x004d3000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x009ec000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x004e9000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00fb5000)
/lib/ld-linux.so.2 (0x00169000)
libgnutls.so.12 => /usr/lib/libgnutls.so.12 (0x00620000)
libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x0069b000)
libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00ad9000)
libcom_err.so.2 => /lib/libcom_err.so.2 (0x006b4000)
libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x006e8000)
libresolv.so.2 => /lib/libresolv.so.2 (0x006b7000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0070d000)
libgcrypt.so.11 => /usr/lib/libgcrypt.so.11 (0x0082c000)
libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00e37000)
libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x006ca000)
and
]$ ldd /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick/RMagick.so
linux-gate.so.1 => (0x00168000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x006a1000)
libz.so.1 => /usr/lib/libz.so.1 (0x00d3f000)
libMagick.so.9 => /usr/lib/libMagick.so.9 (0x00184000)
liblcms.so.1 => /usr/lib/liblcms.so.1 (0x00487000)
libtiff.so.3 => /usr/lib/libtiff.so.3 (0x00cd9000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00125000)
libgs.so.8 => /usr/lib/libgs.so.8 (0x00f52000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00c0b000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x004c5000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x0079a000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x004ce000)
libXt.so.6 => /usr/lib/libXt.so.6 (0x003b2000)
libbz2.so.1 => /usr/lib/libbz2.so.1 (0x00111000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00147000)
libm.so.6 => /lib/libm.so.6 (0x00449000)
libruby.so.1.8 => /usr/lib/libruby.so.1.8 (0x007b4000)
libdl.so.2 => /lib/libdl.so.2 (0x00e7e000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x00db5000)
libc.so.6 => /lib/libc.so.6 (0x00894000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x0076d000)
libcupsimage.so.2 => /usr/lib/libcupsimage.so.2 (0x0040b000)
libcups.so.2 => /usr/lib/libcups.so.2 (0x005cb000)
libssl.so.6 => /lib/libssl.so.6 (0x00601000)
libcrypto.so.6 => /lib/libcrypto.so.6 (0x009c7000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00422000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00afc000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00d75000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x0015b000)
/lib/ld-linux.so.2 (0x00169000)
libgnutls.so.12 => /usr/lib/libgnutls.so.12 (0x00c1b000)
libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x0046e000)
libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00de3000)
libcom_err.so.2 => /lib/libcom_err.so.2 (0x00121000)
libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00646000)
libresolv.so.2 => /lib/libresolv.so.2 (0x0066b000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00438000)
libgcrypt.so.11 => /usr/lib/libgcrypt.so.11 (0x0070f000)
libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00161000)
libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00444000)

Sorry for longish posts…

Lance

unknown wrote:

what do these commands do for you

harp:~ > ruby -r rubygems -e’ require “RMagick”; p Magick ’
Magick

$ ruby -r rubygems -e’ require “RMagick”; p Magick ’

Magick

$ ruby -r rubygems -e’ require “RMagick”; p Magick 'Magick

-e:1: warning: parenthesize argument(s) for future version
-e:1: undefined method `Magick’ for #Object:0xb7f3f970 (NoMethodError)

if that doesn’t work try

harp:~ > LD_LIBRARY_PATH=/usr/lib ruby -r rubygems -e’ require
“RMagick”; p Magick ’
Magick

$ LD_LIBRARY_PATH=/usr/lib ruby -r rubygems -e’ require
“RMagick”; p Magick ’

-e:1:in `require’: wrong number of arguments (0 for 1) (ArgumentError)
from -e:1

Lance

On Sat, 5 Aug 2006, Lance S. wrote:

Magick

therefore, you’ve got it installed. if you are having issues with rails
you
have issues with permissions or you have two rubys installed and the web
users
is using a different one

$ ruby -r rubygems -e’ require “RMagick”; p Magick 'Magick

-e:1: warning: parenthesize argument(s) for future version
-e:1: undefined method `Magick’ for #Object:0xb7f3f970 (NoMethodError)

cut and past error. this is fine

if that doesn’t work try

harp:~ > LD_LIBRARY_PATH=/usr/lib ruby -r rubygems -e’ require
“RMagick”; p Magick ’
Magick

$ LD_LIBRARY_PATH=/usr/lib ruby -r rubygems -e’ require
“RMagick”; p Magick ’

-e:1:in `require’: wrong number of arguments (0 for 1) (ArgumentError)
from -e:1

that has to be on one line!

anyhow. you have installed RMagick and can use it fine from the command
line.
what’s your exact issue in rails then?

-a

unknown wrote:

that is your problem

it’s Magick - not RMagick!

-a

changing:
require ‘rubygems’
require_gem ‘rmagick’
include RMagick

to:
require ‘rubygems’
require_gem ‘rmagick’
include Magick

strangly produces this message:

undefined method `include’ for #MyBountyController:0xb796d1d4

Lance

unknown wrote:

Magick

therefore, you’ve got it installed. if you are having issues with rails
you
have issues with permissions or you have two rubys installed and the web
users
is using a different one

This may or may not have happened when I tried to upgrade the version of
rails.
Don’t know how to check and or rectify…

anyhow. you have installed RMagick and can use it fine from the command
line.
what’s your exact issue in rails then?

Trying to use Rmagick to make thumbnails of images previously stored on
the drive.

You’ve seen the errors above. here is the code as it stands now:

def make_thumb(location, image, thumb)
  require 'rubygems'
  require_gem 'rmagick'
  include Magick

  pic = Magick::Image.read("#{location}#{image}")
  imgwidth = pic.columns
  imgheight = pic.rows
  imgratio = imgwidth.to_f / imgheight.to_f
  imgratio > aspectratio ? scaleratio = 64 / imgwidth : scaleratio = 

64 / imgheight
thumb = pic.resize(scaleratio)

  white_bg = Magick::Image.new(64, thumb.height)
  pic = white_bg.composite(thumb, Magick::CenterGravity, 

Magick::OverCompositeOp)
pic.write(“#{location}#{thumb}”)
end

modified from this site:

(bottom 2 examples)

Lance