lib/smappy/tile.rb in smappy-0.0.2 vs lib/smappy/tile.rb in smappy-0.0.3

- old
+ new

@@ -1,7 +1,7 @@ require 'open-uri' -require 'rmagick' +require 'chunky_png' module Smappy class Tile SIZE = 256 @@ -31,11 +31,12 @@ [center_tile_x - offset_x, center_tile_y - offset_y] end def to_image - data = open(to_url).read - Magick::Image.from_blob(data).first + @tile_image ||= ChunkyPNG::Image.from_datastream( + ChunkyPNG::Datastream.from_io(open(to_url)) + ) end def x @x.to_i end