def set_resolution(columns, rows, options={})
      options[:hor] = :even unless options[:hor]
      options[:ver] = :even unless options[:ver]
      old_cols = @narray.shape[0]
      old_rows = @narray.shape[1]
      if @narray
        # Modify the width only if changed:
        if columns != old_cols
          self.columns = columns.to_i
          old_arr = @narray.dup
          @narray = NArray.int(@columns, @rows)
          if @columns > old_cols
            # New array is larger:
            case options[:hor]
            when :left then @narray[(@columns-old_cols)..(@columns-1), true] = old_arr
            when :right then @narray[0..(old_cols-1), true] = old_arr
            when :even then @narray[((@columns-old_cols)/2+(@columns-old_cols).remainder(2))..(@columns-1-(@columns-old_cols)/2), true] = old_arr
            end
          else
            # New array is smaller:
            case options[:hor]
            when :left then @narray = old_arr[(old_cols-@columns)..(old_cols-1), true]
            when :right then @narray = old_arr[0..(@columns-1), true]
            when :even then @narray = old_arr[((old_cols-@columns)/2+(old_cols-@columns).remainder(2))..(old_cols-1-(old_cols-@columns)/2), true]
            end
          end
        end
        # Modify the height only if changed:
        if rows != old_rows
          self.rows = rows.to_i
          old_arr = @narray.dup
          @narray = NArray.int(@columns, @rows)
          if @rows > old_rows
            # New array is larger:
            case options[:ver]
            when :top then @narray[true, (@rows-old_rows)..(@rows-1)] = old_arr
            when :bottom then @narray[true, 0..(old_rows-1)] = old_arr
            when :even then @narray[true, ((@rows-old_rows)/2+(@rows-old_rows).remainder(2))..(@rows-1-(@rows-old_rows)/2)] = old_arr
            end
          else
            # New array is smaller:
            case options[:ver]
            when :top then @narray = old_arr[true, (old_rows-@rows)..(old_rows-1)]
            when :bottom then @narray = old_arr[true, 0..(@rows-1)]
            when :even then @narray = old_arr[true, ((old_rows-@rows)/2+(old_rows-@rows).remainder(2))..(old_rows-1-(old_rows-@rows)/2)]
            end
          end
        end
      end
    end
def set_resolution(columns, rows, options={})
      options[:hor] = :even unless options[:hor]
      options[:ver] = :even unless options[:ver]
      old_cols = @narray.shape[0]
      old_rows = @narray.shape[1]
      if @narray
        # Modify the width only if changed:
        if columns != old_cols
          self.columns = columns.to_i
          old_arr = @narray.dup
          @narray = NArray.int(@columns, @rows)
          if @columns > old_cols
            # New array is larger:
            case options[:hor]
            when :left then @narray[(@columns-old_cols)..(@columns-1), true] = old_arr
            when :right then @narray[0..(old_cols-1), true] = old_arr
            when :even then @narray[((@columns-old_cols)/2+(@columns-old_cols).remainder(2))..(@columns-1-(@columns-old_cols)/2), true] = old_arr
            end
          else
            # New array is smaller:
            case options[:hor]
            when :left then @narray = old_arr[(old_cols-@columns)..(old_cols-1), true]
            when :right then @narray = old_arr[0..(@columns-1), true]
            when :even then @narray = old_arr[((old_cols-@columns)/2+(old_cols-@columns).remainder(2))..(old_cols-1-(old_cols-@columns)/2), true]
            end
          end
        end
        # Modify the height only if changed:
        if rows != old_rows
          self.rows = rows.to_i
          old_arr = @narray.dup
          @narray = NArray.int(@columns, @rows)
          if @rows > old_rows
            # New array is larger:
            case options[:ver]
            when :top then @narray[true, (@rows-old_rows)..(@rows-1)] = old_arr
            when :bottom then @narray[true, 0..(old_rows-1)] = old_arr
            when :even then @narray[true, ((@rows-old_rows)/2+(@rows-old_rows).remainder(2))..(@rows-1-(@rows-old_rows)/2)] = old_arr
            end
          else
            # New array is smaller:
            case options[:ver]
            when :top then @narray = old_arr[true, (old_rows-@rows)..(old_rows-1)]
            when :bottom then @narray = old_arr[true, 0..(@rows-1)]
            when :even then @narray = old_arr[true, ((old_rows-@rows)/2+(old_rows-@rows).remainder(2))..(old_rows-1-(old_rows-@rows)/2)]
            end
          end
        end
      end
    end
Sets the resolution of the image. This modifies both the pixel data
 (in the specified way) as well as the column & row attributes. The image
 will either be expanded or cropped depending on whether the specified
 resolution is bigger or smaller than the existing one.

 @param [Integer] columns the number of columns in the resized image
 @param [Integer] rows the number of rows in the resized image
 @param [Hash] options the options to use for changing the image resolution
 @option options [Float] :hor the side (in the horisontal image direction) at which to apply the crop/border operation (:left, :right or :even (default))
 @option options [Float] :ver the side (in the vertical image direction) at which to apply the crop/border operation (:bottom, :top or :even (default))