------ art_10942_27360572.1129127185578 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 10/12/05, daz <dooby / d10.karoo.co.uk> wrote: > > > Harold Hausman wrote: > > Hi, > > > > [...] the first code I've shared with you guys: > > Hi Harold - and thanks for doing that. Hey, np, I'm glad I did now! (: > > #But it's 40 lines of pure ruby no lib use binary file up-hackery... > > Excellent. > I refactored a bit: ...snip your most excellent code... > There's one change in effect from your original and I suspect > you may have intended it differently ... > > the_file.read(1).unpack('c')[0] > > .... gives a signed byte so, when you take the average by adding and > dividing by 3, you can be adding negatives. Replacing those with ('C') > gives you unsigned bytes and the overall result matches the output from > the code above. Ah, great point. I was vaguely wondering where the solarization effect was coming from. Unfortunately my attention span is painfully short. ;) Maybe we'll see a smaller fowl soon :-) But what of the majesty of the whole thing?! (: daz > ------ art_10942_27360572.1129127185578--