Problems with image.get(x, y);
in
Programming Questions
•
7 months ago
Hi all,
I'm seem to be having some trouble getting an images value at a specific point. I want my program to run through the pixels in one image (an image of black diagonal lines at 135˚) and every time it hits a pixel that isn't white (I realize my .png doesn't render every line quite equally black as they are on Adobe Illustrator), it gets the value of that pixel in another image and draws it there.
Essentially it draws an image only within the stripes of another image. That's working, but I want to change those colors to be only black, white, or 50% grey, and the colour value it's giving me is -1, and I can't continue until I understand whats going on and fix it.
I don't actually know why even this much of it working, my values don't make any sense to me.
So, my questions are:
Why is my image.get(x,y) :
a) always the same value? As it runs through the frame, shouldn't it change? and
b) always -1? I set it to its absolute value instead, but I still don't get it. How can can the value of point x, y be -1 if x and y are always positive?
Additional comments/explanation of what I'm trying to do and how in the code:
http://pastie.org/6574394
And here are the images I'm working with:
Please help.
I'm really stuck.
I'm seem to be having some trouble getting an images value at a specific point. I want my program to run through the pixels in one image (an image of black diagonal lines at 135˚) and every time it hits a pixel that isn't white (I realize my .png doesn't render every line quite equally black as they are on Adobe Illustrator), it gets the value of that pixel in another image and draws it there.
Essentially it draws an image only within the stripes of another image. That's working, but I want to change those colors to be only black, white, or 50% grey, and the colour value it's giving me is -1, and I can't continue until I understand whats going on and fix it.
I don't actually know why even this much of it working, my values don't make any sense to me.
So, my questions are:
Why is my image.get(x,y) :
a) always the same value? As it runs through the frame, shouldn't it change? and
b) always -1? I set it to its absolute value instead, but I still don't get it. How can can the value of point x, y be -1 if x and y are always positive?
Additional comments/explanation of what I'm trying to do and how in the code:
http://pastie.org/6574394
And here are the images I'm working with:
Please help.
I'm really stuck.
1