1. A computer implemented method for processing hyperspectral or multispectral image data, the image data comprising for each pixel location a sampled image spectrum that comprises multiple first values for each pixel location such that each of the multiple first values is representative of an intensity associated with a wavelength index, the method comprising: determining for each pixel location a coding vector from the multiple first values to one or more second values based on a measure of similarity between pixel locations with respect to the multiple first values, the measure of similarity based on the coding vector, such that two pixel locations that are similar with respect to the multiple first values are also similar with respect to the one or more second values; storing for each pixel location the determined one or more second values associated with that pixel location on a data store; and outputting a visual image of the image data by using the one or more second values as intensity values for one or more respective output channels.