From: Tim Hunter Date: 2008-09-05T06:23:54+09:00 Subject: Re: finding blocks in black-and-white images (efficiently) Axel Etzold wrote: > thank you very much for your help. This script does indeed look very interesting -- and very heroic ! > It would be very nice to have it in RMagick,as far as I am concerned. I fear that my shell scripting > capabilities/knowledge of RMagick will not suffice to get it done in a very short time, so I'd some help to convert it into > Ruby. Also, more generally, how do you wrap ImageMagick functions in RMagick ? Do you call C functions ? > At the install, I was lazy and took the gem option ;) Okay, I'll see what I can do. I'll follow up with you directly. I'm going out of town tomorrow so it may be a couple of days. ImageMagick is essentially a library with a C-level API. (Actually there are two APIs, MagickCore and MagickWand, but that's neither here nor there.) The ImageMagick utilities (convert, mogrify, etc.) are stand-alone programs that call into the library via the API. RMagick uses the library, too. Of course since RMagick is Ruby you get much more use out of the ImageMagick library - access to individual pixels, for example - than you can via the utilities, and Ruby makes it easier to use the API than a shell scripting language does. This page http://studio.imagemagick.org/RMagick/doc/optequiv.html describes some of the RMagick API that corresponds to the ImageMagick commands and options. -- RMagick: http://rmagick.rubyforge.org/