RMagick resize gives images with grey lines!

I'm using RMagick's img.change_geometry() method to resize some
uploaded images and save to the file system.
I've got all of that stuff figured out.
The weird thing is that the resized images have grey starting at some
point in the image, going horizontally and continuing to the end of
the image.
Size does not matter (no pun intended). Neither original dimensions
nor file size.
but the amount of grey is different with different images.
Anybody have this trouble?
(and hopefully some advice)

do I need to call garbage collection? or set some memory limit
somewhere?

thanks ahead of time,
John Joyce

(and hopefully some advice)

Ask on the appropriate list? I don't see a Rails question here. According to the RMagick site[0]

Please remember I can't help with Ruby or √óMagick installation and configuration problems. For help with Ruby, post your questions to comp.lang.ruby. For help with ImageMagick or GraphicsMagick, join the ImageMagick or GraphicsMagick mailing list. See the instructions at http://www.imagemagick.org/script/mailing-list.php or http://sourceforge.net/projects/graphicsmagick/.

Michael Glaesemann
grzm seespotcode net

[0](http://www.imagemagick.org/RMagick/doc/)

whatever, it's totally related and helps others who might have similar
issues.
don't be a jerk. There are plenty of RMagick install questions here.
When dealing with a web framework, the graphics processing libraries
available are totally relevant. What Rails book doesn't talk about
RMagick even a little?
This is absolutely appropriate!
Worry more about list spam shmuck.

whatever, it's totally related and helps others who might have similar
issues.

I'm sorry you feel I'm being a jerk. I don't mean to be. Mailing lists are to help people solve problems, and sometimes the way to solve the problem is to help the person find the appropriate forum for their question. Please note that I did provide you with links to two resources where you might find a solution to your issue.

There are plenty of RMagick install questions here.

And most of them should be addressed in other forums. Just because there's a lot of irrelevant questions doesn't mean that they should continue to be posted here.

When dealing with a web framework, the graphics processing libraries
available are totally relevant.

Questions related to integrating a library with the framework would be appropriate. Actually using the library is not (unless you've exhausted all your other resources, and even then, I'd think twice about posting it here).

What Rails book doesn't talk about
RMagick even a little?

Of the Rails books I have, "Agile Web Development with Rails" (2nd Edition, P2.01) does not have a single mention of RMagick (and only three instances of the word "graphic", for what it's worth). Of the seventy recipes in "Rails Recipes" (P2.0 printing, July, 2006), two discuss processing images (13 and 57). Actually, you might find "Rails Recipes" helpful, Recipe 57 is entitled "Processing Uploaded Images".

As for your RMagick problem, I would try to reproduce what you're seeing in a reproducible test case outside of the Rails framework to isolate the problem and find a solution. If you find it *is* a problem with integrating RMagick with Rails, then after you've searched the web, checked the Rails and RMagick documentation, then it would be appropriate to ask on the Rails list.

You can help make this list better: help people learn to utilize the resources available to them. It's part of helping a community grow and mature. I've seen quite a few posts from you on this and other mailing lists, so I know you're pretty active, and know you can help out improving the quality of the list. I respect you enough to know you can step up to this. If I didn't, I wouldn't have said anything.

Anyway, enough from me. I hope you take this in the spirit it's given. Best of luck with your endeavors.

Michael Glaesemann
grzm seespotcode net

Thanks for your encouragement, but the fact is I have exhaustively
checked other forums, and have been in heavy contact with the
maintainer of RMagick.
I was posting here to find out if anybody has had a similar problem.
I haven't had the problem outside of Rails.
Found nothing in ImageMagick's forums.
I don't post lightly with my own questions prior to trying to find an
answer.
Thanks anyway.
I'll continue developing other features and upload to the server, to
see if it continues on Debian Linux as well.

Hi,

I can't know for sure without looking at the images and the code, but
those lines look like artifacts left from the resizing operation. Even
GIMP or Photoshop will produce those depending on the image being
resized since scaling uses interpolation to achieve the final image
and no interpolation can be perfect.

Anyway, this is just a guess. Try scaling the image on a graphic
programa and see what the program comes up with.

Ronaldo

Thanks for the suggestion Ronaldo,
but I've never seen such artifacts from Photoshop.
It's as if some subroutine is quitting early, leaving grey from an
arbitrary point onwards in the image.
That, or perhaps the image is getting corrupted. Or ImageMagick is
thinking some point in the image's binary is the end of the image,
when it isn't. For a while I thought it was only files output by Adobe
apps, since they do add some proprietary commenting near the end of
files, but I tested files from various sources and the result is the
same, but the grey begins in different places with different images.
With any given file, the result is consistently the same.

I may have to try Image Science or GraphicsMagick, but I'm not looking
forward to reinstalling everything around those at this point.

This is definitely looking like a Rails-related issue, since the same
Ruby code using RMagick works fine outside of Rails!

One curiosity, the RMagick code I'm using is in a controller and not
in a model.
The Rails Cookbook and few posts here recommend putting it in a model.
Could this be part of the problem?

The location of your RMagick code shouldn't affect its behaviour. Perhaps you could post the code so we can examine it?

Regards,
Andy Stewart