By producing compact representations of hyperspectral image cubes (hypercubes), image storage requirements and the amount of time it takes to extract essential elements of information can both be dramatically reduced. However, these compact representations must preserve the important spectral features within hypercube pixels and the spatial structure associated with background and objects or phenomena of interest. This paper describes a novel approach for automatically and efficiently generating a particular type of compact hypercube representation, referred to as a supercube. The hypercube is segmented into regions that contain pixels with similar spectral shapes that are spatially connected, and the pixel connectivity constraint can be relaxed. Thresholds of similarity in spectral shape between pairs of pixels are derived directly from the hypercube data. One superpixel is generated for each region as some linear combination of pixels belonging to that region. The superpixels are optimal in the sense that the linear combination coefficients are computed so as to minimize the level of noise. Each hypercube pixel is represented in the supercube by applying a gain and bias to the superpixel assigned to the region containing that pixel. Examples are provided.