Figure 1: A pyramid of smiley face differences
Performs a Discrete Wavelet Transform (DWT) analysis on the selected images by means of the Haar wavelet basis, producing a pyramid of differences at powers-of-two scales, with the one base image at the highest scale occupying the upper left corner of the image, (see example on the left), and the difference images, at decreasing scales (and larger size) radiating out in concentric ranks to the lower right. This pyramid constitutes a DWT analysis of the input image.
The base image can be as small as one pixel, though it will be larger if at least one dimension of the original image is not a power of two or the image is not square (see nb_scales, following).
-ihaar is the companion G'MIC DWT synthesis command, which recovers the original when given an analysis produced by -haar.
The format of the command is:
-haar nb_scales > 0
The G'MIC script on the left defines a command called '-pixelate.' Copy this into your local “~/.gmic” file (Unix-like OS) or /%APPDATA%/gmic (Windows).
When an image has been analyzed, it is susceptible to spectral editing. To “pixelate” an image this script makes a boolean mask that zeros-out difference images at or lower than the scale specified by coarse. With these removed from the pyramid, the subsequent synthesis will only be able to partially recover the image. The result appears pixelated due to the character of the Haar wavelet, a square function that transitions from 0 to 1, 1 to -1, then -1 to zero.
An optional flag, details=1, separates out the details into another image. This entails using an inverted version of the boolean mask that zeros out the scales the first one preserves, and retains the scales the first one removes.
In either case, -ihaar performs a synthesis on an edited pyramid stack and restores only subsets of the information originally contained in the input image.
See Wavelet Analysis and Synthesis in G'MIC in the Technical Notes section for the background on this command and its inverse, -ihaar.