def [] (x,y)
      if x.instance_of? Fixnum and y.instance_of? Fixnum
        get_pixel(fixx(x),fixy(y))
      else
        x = (fixx(x)..fixx(x)) if x.instance_of? Fixnum
        y = (fixy(y)..fixy(y)) if y.instance_of? Fixnum

        if x.instance_of? Range
          x = (fixx(x.first)..fixx(x.last))
        end

        if y.instance_of? Range
          y = (fixy(y.first)..fixy(y.last))
        end

        newimg = Image.new(x.last + 1 - x.first, y.last + 1 - y.first)

        width = x.count
        (0..y.count).each do |y_|

          destpointer = y_*width*3
          origpointer = ((y.first + y_)*self.width + x.first)*3

          newimg.pixel_data[destpointer..destpointer+width*3] =
            self.pixel_data[origpointer..origpointer+width*3]
        end

        newimg
      end
    end
def [] (x,y)
      if x.instance_of? Fixnum and y.instance_of? Fixnum
        get_pixel(fixx(x),fixy(y))
      else
        x = (fixx(x)..fixx(x)) if x.instance_of? Fixnum
        y = (fixy(y)..fixy(y)) if y.instance_of? Fixnum

        if x.instance_of? Range
          x = (fixx(x.first)..fixx(x.last))
        end

        if y.instance_of? Range
          y = (fixy(y.first)..fixy(y.last))
        end

        newimg = Image.new(x.last + 1 - x.first, y.last + 1 - y.first)

        width = x.count
        (0..y.count).each do |y_|

          destpointer = y_*width*3
          origpointer = ((y.first + y_)*self.width + x.first)*3

          newimg.pixel_data[destpointer..destpointer+width*3] =
            self.pixel_data[origpointer..origpointer+width*3]
        end

        newimg
      end
    end
Returs the color of a pixel locate in the given x and y coordinates
 or a rectangle section of the image if a range is specified

 Example

   image[0,0] # return a Color object representing the color of the pixel at 0,0
   image[0..20,10..30] # return a image object with the cropped rectagle with x between 0 and 20 and y between 10 and 30
   image[0..20,20] # return a image object cropped rectagle with x between 0 and 20 and y equals 15