models/drawing/image.rb
def image_raw_data(thumb_url)
      raw_data = []
      open(thumb_url) do |f|
        image_list = Magick::Image.from_blob(f.read)
        image_list.each do |image|
          raw_data << (0..15).map do |i|
            (0..15).map do |j|
              # thumbs size 64x64, image size 16x16, zoom 4x 
              parse_pixel_color(image.pixel_color(i*4, j*4))
            end
          end 
        end

        raw_data
      end
    end
# downloads thumb image, parses it and returns raw data
#
# KNOWN BUG: calling this function on PNG images where there's
#            only black color returns an array full of black.
downloads thumb image, parses it and returns raw data
KNOWN BUG: calling this function on PNG images where there's
only black color returns an array full of black.
downloads thumb image parses it and returns raw data KNOWN BUG : calling this function on PNG images where there ' s only black color returns an array full of black .
def image_raw_data(thumb_url)
      raw_data = []
      open(thumb_url) do |f|
        image_list = Magick::Image.from_blob(f.read)
        image_list.each do |image|
          raw_data << (0..15).map do |i|
            (0..15).map do |j|
              parse_pixel_color(image.pixel_color(i*4, j*4))
            end
          end 
        end
        raw_data
      end
    end
def image_raw_data ( thumb_url ) raw_data = [ ] open ( thumb_url ) do | f | image_list = Magick :: Image . from_blob ( f . read ) image_list . each do | image | raw_data << ( 0 .. 15 ) . map do | i | ( 0 .. 15 ) . map do | j | parse_pixel_color ( image . pixel_color ( i * 4 , j * 4 ) ) end end end raw_data end end
downloads thumb image, parses it and returns raw data
KNOWN BUG: calling this function on PNG images where there's
only black color returns an array full of black.
downloads thumb image parses it and returns raw data KNOWN BUG : calling this function on PNG images where there ' s only black color returns an array full of black .
# thumbs size 64x64, image size 16x16, zoom 4x 
thumb_url