moving functions from ImageUtils to RasterUtil