basic image process suggestion?

9 views
Skip to first unread message

Surfman Joe

unread,
Feb 22, 2007, 10:02:38 AM2/22/07
to rubyonra...@googlegroups.com
I need

1) upload image (JPG/GIF/BMP/etc) to pre-designated path
2) auto resize the image and generate thumb image based on the
pre-defined width or length, keep ratio
3) best performance

Thanks for any recommendation.

--
Posted via http://www.ruby-forum.com/.

Jarod Reid

unread,
Feb 22, 2007, 10:05:28 AM2/22/07
to rubyonra...@googlegroups.com
Take a look at RMagic. Good for what your looking for.

Guest

unread,
Feb 22, 2007, 10:54:03 AM2/22/07
to rubyonra...@googlegroups.com
Surfman Joe wrote:
> I need
>
> 1) upload image (JPG/GIF/BMP/etc) to pre-designated path
> 2) auto resize the image and generate thumb image based on the
> pre-defined width or length, keep ratio
> 3) best performance
>
> Thanks for any recommendation.

Investigate the acts_as_attachment plugin which has RMagick integration.

Jeff

unread,
Feb 22, 2007, 1:42:51 PM2/22/07
to Ruby on Rails: Talk
Another recommendation would be the file_column plug-in (http://
wiki.rubyonrails.org/rails/pages/HowToUseFileColumn). It is lighter
(though not necessarily better) than acts_as_attachement and also uses
RMagick for image manipulation.

Carl Lerche

unread,
Feb 22, 2007, 2:34:34 PM2/22/07
to rubyonra...@googlegroups.com
Do NOT use RMagick for image manipulation. Using RMagick in a rails
process will cause the memory usage of each process to skyrocket. You
will run into a lot of trouble later on (from personal experience).

Delegate image manipulation to a seperate process. The easiest thing
to do in this case is simply run `convert` (imagemagick's command line
tool) on the image to generate a thumbnail.

-carl


--
EPA Rating: 3000 Lines of Code / Gallon (of coffee)

Tom Fakes

unread,
Feb 22, 2007, 8:49:00 PM2/22/07
to Ruby on Rails: Talk
The RMagick documentation is clear on this - you must invoke the
Garbage collector manually after RMagick processing, as Ruby doesn't
track the RMagick memory used.

file_column does this, but if you do your own RMagick code, you must
call GC.start once your processing is complete.

On Feb 22, 11:34 am, "Carl Lerche" <carl.ler...@gmail.com> wrote:
> Do NOT use RMagick for image manipulation. Using RMagick in a rails
> process will cause the memory usage of each process to skyrocket. You
> will run into a lot of trouble later on (from personal experience).
>
> Delegate image manipulation to a seperate process. The easiest thing
> to do in this case is simply run `convert` (imagemagick's command line
> tool) on the image to generate a thumbnail.
>
> -carl
>

Jarod Reid

unread,
Feb 23, 2007, 8:03:18 AM2/23/07
to rubyonra...@googlegroups.com
Which rules out the memory problem and proves the use of actually reading
documentation. :)

Tim Hunter

unread,
Feb 23, 2007, 7:02:32 PM2/23/07
to rubyonra...@googlegroups.com
Tom Fakes wrote:
> The RMagick documentation is clear on this - you must invoke the
> Garbage collector manually after RMagick processing, as Ruby doesn't
> track the RMagick memory used.
>
> file_column does this, but if you do your own RMagick code, you must
> call GC.start once your processing is complete.

Thanks for saying this, Tom. I'm glad to see that this information is
getting out. It makes me sad when people say that RMagick "leaks" memory
when judicious use of GC.start would've solved their problem. If they
had emailed me I would've tried to help.

Not that I'm saying that it's impossible for RMagick to have a memory
leak. That would just be asking for trouble! I am saying that anybody
who thinks that RMagick has a memory leak should email me at rmagick AT
rubyforge DOT org to complain, or open a bug track on RubyForge. If I
know about a problem and can reproduce it, then I can fix it. I'd even
thank you for reporting the problem!

P.S. The RMagick documentation that Tom is referring to is a thread in
the RMagick Hints and Tips Forum on RubyForge:
http://rubyforge.org/forum/forum.php?thread_id=1374&forum_id=1618. If
you have a suggestion about a better way for me to promulgate this
information please let me know. Thanks!

Al Evans

unread,
Feb 24, 2007, 8:44:59 AM2/24/07
to rubyonra...@googlegroups.com
Tim Hunter wrote:
> Tom Fakes wrote:
>> The RMagick documentation is clear on this - you must invoke the
>> Garbage collector manually after RMagick processing, as Ruby doesn't
>> track the RMagick memory used.
>>
>> file_column does this, but if you do your own RMagick code, you must
>> call GC.start once your processing is complete.
>
> Thanks for saying this, Tom. I'm glad to see that this information is
> getting out. It makes me sad when people say that RMagick "leaks" memory
> when judicious use of GC.start would've solved their problem. If they
> had emailed me I would've tried to help.

Tim speaks the truth on both counts. RMagick doesn't leak memory if you
remember to call GC.start after each image-processing operation. AND
he's a very helpful person.

I've got an all-RMagick application at

http://psitsnot.alevans.com

It's been running for almost a year, on a shared host, and has no memory
issues.

--Al Evans

Reply all
Reply to author
Forward
0 new messages