GIMP Script-fu

sg-indexed-decompose
Login
Command:
Indexed Decompose
Menu:
"<Image>/Filters/Colors/Indexed Decompose"
PDB Name:
script-fu-sg-indexed-decompose
Download:
sg-indexed-decompose.scm (after the page appears, click on the "Download" command)
License:
GPLv2+

Description:

This script will split a layer into separate layers based upon its original colors. The original layer is not affected, instead a new layer group containing the generated layers will be created.

If the original image is in Indexed Mode then the number of layers created will be equal to the number of colors in the original layer's palette(/colormap). If the original is in RGB or Grayscale Mode then the number of layers created will be the number of unique colors in the original, up to a maximum of 256 colors. It is typically advisable my Quantize script be used to reduce the number of colors in an RGB image before running this script.

Note: this script requires GIMP 2.8 or later.

The following graphic shows the layerstack of the result of running the script on an 8-color rendering of the image on the right (image courtesy of user Nachbarnebenan of the Meet The GIMP forums):