Skip to content

Instantly share code, notes, and snippets.

@roshkins
Created March 25, 2014 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roshkins/9772469 to your computer and use it in GitHub Desktop.
Save roshkins/9772469 to your computer and use it in GitHub Desktop.
Here is how I generated my image...
require 'RMagick'
include Magick
img = Image.new(1000,1000)
def fib_arr(num)
return [1] if num == 1
return [1,1] if num == 2
nums = fib_arr(num-1)
return nums + [nums[-1] + nums[-2]]
end
fib_nums = fib_arr(3000)
def z(x, y, fib_nums)
y*fib_nums[x] % MaxRGB
end
1000.times do |y|
1000.times do |x|
r = z(x*3,y, fib_nums)
g = z(x*3+1,y, fib_nums)
b = z(x*3+2,y, fib_nums)
# puts "#{x}, #{y}: r #{r} g #{g} b #{b}"
p = Pixel.new(r, g, b, 0)
# p "#{p}"
img.pixel_color(y, x, p)
# p "#{img.pixel_color(x,y)}"
end
# img.display if y % 50 == 0
end
img.display
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment