Permalink
Browse files

reversing x dimension

  • Loading branch information...
1 parent 1040555 commit a4f1af4e49e33ed3e18b34044fb4ea00048837c5 Jeffrey Warren committed Feb 25, 2011
Showing with 24 additions and 1 deletion.
  1. +1 −1 string-bitmap.rb
  2. +23 −0 string-generate-test.rb
View
@@ -26,7 +26,7 @@
puts data.length.to_s + "," + data[0].length.to_s
img = Magick::Image.new(data.length, data[0].length)
-data.each_with_index do |row, row_index|
+data.reverse.each_with_index do |row, row_index|
row = row.reverse unless row_index.odd?
row.each_with_index do |item, column_index|
#puts "setting #{row_index}/#{column_index} to #{item}"
View
@@ -0,0 +1,23 @@
+require 'rubygems'
+require 'RMagick'
+
+f = File.new(ARGV[0], "r")
+
+data = Array.new
+
+max = 0
+min = 999
+
+120.times do
+ data_col = Array.new
+ if col[0] != 60 # if it's not the line number <#>
+ # check for trailing comma, remove it:
+ col = col[0..-4] if col[-3] == 44
+ col.split(',').each do |cell|
+ data_col << cell
+ max = cell.to_f if cell.to_f > max
+ min = cell.to_f if cell.to_f < min
+ end
+ data << data_col
+ end
+end

0 comments on commit a4f1af4

Please sign in to comment.