Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Ruby - RMagick -- Python Challenge

Name: Anonymous 2012-03-19 0:59

sup /prog/,

I'm doing Python Challenge 7(http://www.pythonchallenge.com/pc/def/oxygen.html), and have it pretty much figured out, however I am having trouble with the RMagick library. I'm an experienced programmer, however I am new to Ruby. There is a hidden message encoded into the image, you can see it, it is the gray strip across the center. Each color corresponds to a hex number, which can be converted to an ascii character. However, when looping through each color, I get a bounds error at pixel 317(on the x axis), when the image is actually 629 pixels wide.

Here's the error I get:

 [10challenge7.rb:20:in `get_pixels': geometry (317x47+317+47) exceeds image bounds (RangeError)
from challenge7.rb:20:in `block in <main>'
from challenge7.rb:18:in `each'
from challenge7.rb:18:in `<main>'

Here's my code: http://pastebin.com/CAQs18Ri

Any help is very much appreciated, I just don't understand why it says I'm exceeding the image bounds when I'm not. I'm able to read this much of the hidden message:

    smart guy, you made it. the next level is

Name: Anonymous 2012-03-19 2:39

dimensions of the rectangle for the second pair
I have them the same because I want to get a single pixel in the array

So you're fetching a square grid. Do I have to spell it out this much? It's NOT (from x, from y, to x, to y). It's (from x, from y, width, height).

In your case you'd want the 3rd and 4th args to be 1 and 1.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List