GIMP can convert images from RGB mode to Indexed mode through the "Convert Image to Indexed Colors" dialog (Image > Mode > Indexed...). In that dialog, there is an option to generate an optimum palette with a specified maximum number of colors in the generated palette. For images that contain huge regions of the same color (e.g. screenshots of windows), generating an optimum palette could substantially reduce the file size of exported images while having minimal quality loss.
For screenshots in PNG format, I noticed that GIMP almost always produces smaller images with its optimum palette algorithm than when I use ImageMagick 6 to reduce colors via its -colors option. While ImageMagick's documentation describes the color reduction algorithm that ImageMagick uses, GIMP's documentation does not describe GIMP's algorithm.
What is GIMP's algorithm for generating an optimum palette?
(GNU Image Manipulation Program version 2.10.34)
