# Image.glcmTexture: Only 32-bit or smaller integer types are currently supported

I´m using entropy and GLCM function of Google Earth Engine (https://developers.google.com/earth-engine/guides/image_texture). I want to use NDVI band, obtained from landsat 8 image band algebra:

`````` //Agregar bandas
var addVI = function(image) {
var ndvi = image.normalizedDifference(['B5', 'B4']).rename('NDVI');
return image.addBands(ndvi);
};
var withVI = filteredCollection.map(addVI);
print ("conBandas", withVI);

//COMPOSICIONES
//Composicion de imagenes 2014
var cverano2014 = withVI.filterDate('2013-12-01', '2014-03-31');
print ("Coleccion2014", cverano2014);
//Buscar Imagen Limpia 2014
var listImages = cverano2014.toList(cverano2014.size());
var il2014 = ee.Image(listImages.get(0)).clipToCollection(table);
Map.addLayer(il2014, trueColour, "ImagenLimpia2014");

// Get the NIR band.
var iv = il2014.select('NDVI');
// Define a neighborhood with a kernel.
var square = ee.Kernel.square({radius: 3});
// Compute entropy and display.
var entropy = iv.entropy(square);
print('entropy', entropy);
Map.addLayer(entropy,
{min: 1, max: 5, palette: ['0000CC', 'CC0000']},
'entropy');

// Compute the gray-level co-occurrence matrix (GLCM), get contrast.
var glcm = iv.glcmTexture({size: 3});
print(glcm)
var contrast = glcm.select('NDVI_contrast');
print('constrast', contrast);
Map.addLayer(contrast,
{min: 0, max: 1500, palette: ['0000CC', 'CC0000']},
'contrast');
``````

Well, when I run the code, console show me:

Image (Error) Image.glcmTexture: Only 32-bit or smaller integer types are currently supported.

How do I reduce bit of my bands, or transform band to type integer?

## 2 Answers

The NDVI has values from -1 to +1. You can also use the following to generate a 8bit NDVI:

``````// Rescale NDVI [0-255]
var iv = il2014.select('NDVI').unitScale(-1, 1).multiply(255).toByte();
``````

The quickest way would be to just add a call to cast the iv image into 32-bit or smaller using the toInt() or .toUint() functions. The code below would cast your image to unsigned 32-bit integer prior to the entropy and glcm calculations.

``````// Get the NIR band.
var iv = il2014.select('NDVI').toUint32();
``````
• Thank you! .ToInt16 () has served me well. Regards! Commented Sep 11, 2020 at 21:32
• great! if you can mark this as the preferred solution that would be helpful to others. Commented Feb 10, 2023 at 21:12