Sha256: 229c417ba41a37f47690a71be4bfbfbbf1c0903166b4d2998aca4bb02f95d5c4
Contents?: true
Size: 692 Bytes
Versions: 8
Compression:
Stored size: 692 Bytes
Contents
# frozen_string_literal: true class Map::Gdal::ConstrastStretchService include Map::Gdal::Base attr_reader :file def initialize(file) raise 'File does not exist' unless File.exist?(file) @file = file end def call(options = {}) file_out = get_path_to_temp_file(:gdal_contrast_stretch, :tif) add_to_clean(file_out) options['percentile-range'] = '0.02 0.98' if options.empty? result = run_command(%{gdal_contrast_stretch #{options_to_command_line(options)} "#{file}" "#{file_out}"}) found_min_max = result.match(/src_range=\[(.+), (.+)\]/) { file: file_out, min: found_min_max[1].to_f, max: found_min_max[2].to_f, } end end
Version data entries
8 entries across 8 versions & 1 rubygems