I am a student and new Google Earth Engine user.

I need to convert the pixel type of image from 16 bit to 8 bit to calculate Forest Canopy Density in google earth engine. I am seeking a way to solve this problem.

Can you help me?

closed as off-topic by PolyGeo Jan 28 at 23:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.


There is no repeatable code above, but this should get you started: https://developers.google.com/earth-engine/image_visualization

var imageRGB = image.visualize({bands: ['B5', 'B4', 'B3'], max: 0.5});
var ndwiRGB = ndwiMasked.visualize({
  min: 0.5,
  max: 1,
  palette: ['00FFFF', '0000FF']

The image.visualize() function converts images to 8-bit.

  • Thanks. Your answer is helpful for me. Have a nice day. – phonepyaitun Jan 29 at 8:25

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