I am creating a composite image of Landsat 8 OLI of Okinawa and want to export the true color image to my google drive as a tif file. I was able to successfully download it, but the image (img2) looks very different than what was rendered on my screen (img1). Could someone let me know what I might be doing wrong?

img1 enter image description here

img2 enter image description here

    function maskL8sr(image) {
  // Bits 3 and 5 are cloud shadow and cloud, respectively.
  var cloudShadowBitMask = 1 << 3;
  var cloudsBitMask = 1 << 5;

  // Get the pixel QA band.
  var qa = image.select('pixel_qa');

  // Both flags should be set to zero, indicating clear conditions.
  var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0)

  // Return the masked image, scaled to TOA reflectance, without the QA bands.
  return image.updateMask(mask).divide(10000)
      .copyProperties(image, ["system:time_start"]);

// Map the function over one year of data.
var collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
    .filterDate('2017-01-01', '2018-09-09')

var composite = collection.median();


// Display the results.
Map.addLayer(composite, {bands: ['B4', 'B3', 'B2'], min: 0, max: 0.3});

// Create a geometry representing an export region.
var geometry = ee.Geometry.Rectangle([126.551513671875,26.03704188651584,128.86962890625,27.518015241965667]);

// Export the image, specifying scale and region.
  image: composite,
  description: 'OkinawaLandsat2018',
  scale: 30,
  region: geometry,
  fileFormat: 'GeoTIFF'

I selected a smaller region for testing, and the exported image is fine. Probably, you are setting the visualization parameters different in you local viewer. I used QGIS:

enter image description here

You can see in the screenshot how I set the parametes in QGIS and the result, and that it's exactly the same as the image in the code editor

  • Thank you, it worked in qgis for me – jhjanicki Mar 21 at 14:30

1.) What are you viewing the tiff image with? QGIS?

2.) I'm not sure whether this is a factor, but when you might first want to create an image from your collection median. With:

var composite = ee.Image(collection.median());

3.) you can select the image bands (function .select()) you want to export, currently all bands are exported, so whatever viewer you are using you need to define the same visualization scheme, basically you only need bands 4,3 and 2.

You can find more info here on the creation of an image: https://www.youtube.com/watch?v=yHcP97gBi0Q

  • Thank you for the recommendations. and the video was helpful too – jhjanicki Mar 21 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.