GIMP Script-fu

Update of "sg-quantize"
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: b82b6b66877ce5c85306804c457bf477b82e0233
Page Name:sg-quantize
Date: 2014-01-06 15:17:53
Original User: saulgoode
Parent: 074286430e1fc61da4810f9215a4deab24156f52 (diff)
Content
Command:
Quantize
Menu:
"<Image>/Colors/Quantize..."
PDB Name:
script-fu-sg-quantize
Download:
sg-quantize.scm (after the page appears, click on the "Download" command)
License:
GPLv2+

Description:

This script will reduce the active layer to the specified number of colors (also works on layer masks and channels). An option is available for the amount of smoothing applied to the edges between colors (default is none). There is also a "Rounded?" option which produces a slightly different distribution of the colors, typically one more abstract. The final option, "Use selection as smoothing mask", will protect the selected region from smoothing; however, the entire layer is converted to the reduced color scheme. Finally, a "polygonal" option is available that attempts to straighten the edges between colors (dramatically affected by the amount of smoothing).

With no smoothing (the default setting), the effect on the layer is identical to converting to Indexed mode with the specified number of colors; however, this script has the advantage of not affecting other layers in the image.

NOTE: The polygonal option can cause the script to run very slowly, especially with low values of smoothing.

Starting with the following image, courtesy of user Nachbarnebenan of the Meet The GIMP forums:

The default values will produce the following result (note that this is equivalent result to converting to Indexed Mode with 16 colors):

And with a smoothing value of "3":

And with the "Use selection as smoothing mask" option. Note how the selection around the hair protects it from smoothing, yet it is still converted to the limited color scheme.

And finally, here is the result of using the polygonal option (and with a smoothing of "3").