From: Robert Klemme Date: 2009-12-08T00:45:03+09:00 Subject: Re: Reading Images 2009/12/7 Alexandro Kez > > Hei there, ruby coders, > I'm quite new to ruby and have just done some very basic projects for my > university and now have encountered a problem while programming CG with > openGL bindings for ruby. Most my mates are very pesimistic about > programming CG with ruby, but not me. > Well, my actual problem is: >  I'm trying to put a texture on some shape, thus I need to load a JPEG > to ram, get it's width/height and read every number that represents > color code of each pixel. I just need to get width/height + array of > numbers that would represent colors. With ruby I can read only lines as > string from file? Or I'm not right? You can read arbitrary binary content: data = File.open("foo.jpg", "rb") {|io| io.read} Does that help? Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/