Landsat-8 pansharp

Has anyone tried to create or get a Landsat-8 pansharp image through a evalscript JS code?

Perhaps this FAQ can help?

1 Like

Tried script in your link and below script (both seem to produce comparable images), but still not a “pansharp” image…
let minVal = 0.0;
let maxVal = 0.4;

let viz = new Identity(minVal, maxVal);

function evaluatePixel(samples) {
let sudoPanW = (samples[0].B04 + samples[0].B03 + samples[0].B02 * 0.4) / 2.4;
let ratioW = samples[0].B08 / sudoPanW;
let val = [samples[0].B04 * ratioW, samples[0].B03 * ratioW, samples[0].B02 * ratioW];
return => viz.process(v));

function setup(ds) {
setInputComponents([ds.B02, ds.B03, ds.B04, ds.B08]);

Some thing along this lines:

I found this script to pansharpen L8 (

How can I edit this to work with L8 data in SH Py? I understand some are GEE functions…

// Band combinations
var natural = [‘B4’, ‘B3’, ‘B2’];
var swir = [‘B6’, ‘B5’, ‘B3’];
var urban = [‘B7’, ‘B6’, ‘B4’];
var veg = [‘B5’, ‘B4’, ‘B3’];

// Get a Landsat scene
var scene = ee.Image(‘LANDSAT/LC8_L1T_TOA/LC80450332015263LGN00’);

// Convert the RGB bands to the HSV
var hsv =;

// Add band 8 and convert back to RGB
var sharpened =[‘hue’),‘saturation’),‘B8’)

// Do a very basic color correction
var imageRGB = sharpened.visualize({min: 0, max:0.18,
1.05, // red
1.08, // green
0.8] // blue

// Display the image and zoom to it
Map.centerObject(sharpened, 9);

If you multiply each element in let val = [samples[0].B04 * ratioW, samples[0].B03 * ratioW, samples[0].B02 * ratioW]; with 2.5, you get the same output as in EO Browser for True color - pansharpened layer for Landsat 8.

1 Like

Thanks, but what’s the logic of multiplying each band by 2.5? I’m little confused and not sure if you want me to edit my script I posted or just use your script?

See here for examples: