I am using QGIS 2.18.3 (I know, it's an old version now) on Windows 7. I have a raster of forest groups for Oregon, saved as the .img format and is rendered as Paletted. It was clipped from a raster of forest groups for the entire U.S. The legend in the Layers Panel for the OR layer has all of the forest group pixel values (a few hundred different values), even though there are only about 25 different pixel values in the OR layer.
How do I get the legend to not show all the values that don't actually occur in the layer?
Related to this, if I save as .tiff, the layer's legend only has min and max values, which leaves out a bunch of the pixel values.
EDIT: I've added a screenshot of QGIS to show the legend. All the values that appear in the screenshot legend aren't used in the raster. Those, plus the other unused values, are the ones I want to remove.