pixel-utils
Version:
Utility Functions for Pixels
12 lines (11 loc) • 400 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = convert_raw_one_band_pixel_to_rgba_string;
function convert_raw_one_band_pixel_to_rgba_string(old_no_data_value, noDataPixel, scalefn, pixel) {
const n = pixel[0];
if (n === old_no_data_value) return noDataPixel;
const scaled = scalefn(n);
return `rgba(${scaled}, ${scaled}, ${scaled}, 255)`;
}