# Image libraries for Ruby?

**URL:** <https://www.ruby-forum.com/t/image-libraries-for-ruby/116533>\
**Category:** Ruby\
**Created:** [October 7, 2007, 12:02am UTC](https://www.ruby-forum.com/t/image-libraries-for-ruby/116533 "2007-10-07T00:02:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![forgottenwizard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/41988e/32.png) [@forgottenwizard](https://www.ruby-forum.com/u/forgottenwizard)\
**Post date:** [October 7, 2007, 12:02am UTC](https://www.ruby-forum.com/t/image-libraries-for-ruby/116533/1 "2007-10-07T00:02:41Z")

</div>

I’m trying to write out a script to help me sort out a bunch (more than  
1,000) wallpapers, and do so by wallpaper size. I’ve done a little  
looking, but so far the only lib I have seen that might help is  
ImageMagick, and I want to see if anyone knows of another to do this.

How I’m trying to do this:

gather the x and y size of the wallpaper (this is the hard part from  
what I can see).

move that wallpaper into a directory with those dimensions as the name  
(such as 1280x1024)

echo the name of that wallpaper, based on a set of rules, into a file to  
use as a sort of database to help keep up with everything.

---

<div class="post-metadata">

**Author:** ![forgottenwizard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/41988e/32.png) [@forgottenwizard](https://www.ruby-forum.com/u/forgottenwizard)\
**Post date:** [October 7, 2007, 12:08am UTC](https://www.ruby-forum.com/t/image-libraries-for-ruby/116533/2 "2007-10-07T00:08:31Z")

</div>

> move that wallpaper into a directory with those dimensions as the name  
> (such as 1280x1024)
> 
> echo the name of that wallpaper, based on a set of rules, into a file to  
> use as a sort of database to help keep up with everything.

[http://pastie.caboo.se/98119](http://pastie.caboo.se/98119)

If they are all JPEG’s that will work. If not, google around and you’ll  
find the routines for figuring it out for other image types. Or look at  
PHP’s getimagesize method’s source which handles GIF, JPG, and PNG. All  
it does is read some bits from the beginning of the file to get the  
right  
one.

-philip

---

<div class="post-metadata">

**Author:** ![forgottenwizard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/41988e/32.png) [@forgottenwizard](https://www.ruby-forum.com/u/forgottenwizard)\
**Post date:** [October 7, 2007, 1:22am UTC](https://www.ruby-forum.com/t/image-libraries-for-ruby/116533/3 "2007-10-07T01:22:10Z")

</div>

“forgottenwizard” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote in message  
news:20071006215851.GA28936@localhost…

> I’m trying to write out a script to help me sort out a bunch (more than  
> 1,000) wallpapers, and do so by wallpaper size. I’ve done a little  
> looking, but so far the only lib I have seen that might help is  
> ImageMagick, and I want to see if anyone knows of another to do this.

```
What's wrong with ImageMagick? It'll do what you need...

```

---

<div class="post-metadata">

**Author:** ![forgottenwizard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/41988e/32.png) [@forgottenwizard](https://www.ruby-forum.com/u/forgottenwizard)\
**Post date:** [October 7, 2007, 11:20pm UTC](https://www.ruby-forum.com/t/image-libraries-for-ruby/116533/4 "2007-10-07T23:20:13Z")

</div>

On 7-okt-2007, at 1:20, Just Another Victim of the Ambient M.  
wrote:

> ```
> What's wrong with ImageMagick? It'll do what you need...
> 
> ```

Depends on what system you are running, might be problematic if it’s  
Win32 but if you are in the Mac or  
if you already have ImageMagick (with convert and stuff, not the  
devel libs) you can try my ImageProc. It’s basically  
one-sop API for bounds-resizing, in one file.

[http://julik.textdriven.com/svn/tools/ruby\_libs/image\_proc/image\_proc.rb](http://julik.textdriven.com/svn/tools/ruby_libs/image_proc/image_proc.rb)

I do like the idea of scanning the headers PHP style, might have a go  
at it once for ImageProc 🙂

---

<div class="post-metadata">

**Author:** ![forgottenwizard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/41988e/32.png) [@forgottenwizard](https://www.ruby-forum.com/u/forgottenwizard)\
**Post date:** [October 8, 2007, 5:27am UTC](https://www.ruby-forum.com/t/image-libraries-for-ruby/116533/5 "2007-10-08T05:27:16Z")

</div>

On 06:18 Mon 08 Oct , Julian T. wrote:

> [textdriven.com&nbsp;-&nbsp;textdriven Resources and Information.](http://julik.textdriven.com/svn/tools/ruby_libs/image_proc/image_proc.rb)
> 
> ## I do like the idea of scanning the headers PHP style, might have a go at it once for ImageProc 🙂
> 
> Julian ‘Julik’ Tarkhanov  
> please send all personal mail to  
> me at julik.nl

I didn’t want to use ImageMagick because it did a bit more than I wanted  
it to, but I went ahead an installed it.

I may look into your lib some, but that may come later when I know that  
what I’m trying to do works.
