On Mon, 12 May 2003 06:56:27 +0900
"meinrad.recheis" <my.name.here / gmx.at> wrote:

<snip> 
> data = ''
> (width*height).times{
>   data += rgb.read( 3) + alpha.read( 1)
> }
> 
> i think alternately reading some bytes is slowing down alot. but also loops 
> operating on strings are
> slow, i think. i know some solutions, but i don t know which one to use.
> are there any suggestions how to do this most efficiently in ruby?
<snip>

Read everything into an array or string and go from there... I don't
thing String operations are particularly slow, but I could be wrong.
You _might_ read in the entire file as a string (or a given chunk, for
scaleability's sake), String#unpack it, and go from there, but that
sounds like a waste of memory for something like this.

-- 
Ryan Pavlik <rpav / users.sf.net>

"Darn that uncertainty principle! It always gets me lost." - 8BT