I've attached a patch implementing most of Photoshop's separable compositing operations, using the formulas in the final Adobe PDF specs and the text descriptions on Wikipedia's "Blend modes" article. In addition to the composite operation code itself, this required changing .psd file input/output, .xcf input/output, and the headers for PerlMagick and TclMagick. No test operations or examples were created.
These operations have been tested using command line and Magick++, comparing the output against the output of the same operations in Photoshop CS6 and (where implemented) ImageMagick 6.
Existing operations modfied:
Difference, Darken, Lighten, HardLight
Overlay, Exclusion, ColorBurn, ColorDodge, SoftLight, LinearBurn, LinearDodge, LinearLight, VividLight, PinLight, HardMix
Comments on specific operations:
- There is no clear counterpart to PS "Normal"; "Over" does not give the same result, either here or in IM.
- I'm not sure how to implement Dissolve; which pixels are chosen is some kind of pseudorandom process.
- The current GM implementations of the Darken and Lighten operations are incorrect; they only take into account complete transparency, not alpha-blending. I have reimplemented them.
- ColorBurn and ColorDodge work differently in CS6 then the formula suggests, with a discontinuity in the filter for destination values of exactly MaxRGB (0 resp.). I have implemented these operations according to the formula, so they do not match PS exactly. IM matches PS for ColorBurn, and follows the formula for ColorDodge.
- The current GM implementation of HardLight does not consider alpha values at all; I have reimplemented it.
- HardMix takes the average pixel value then thresholds it at 0.5; Photoshop's implementation seems to include an asymmetry, where a white source over a black destination is black, while a black source over a white destination is white, though the average values are the same. IM has a symmetric filter. I have implemented a symmetric filter as well.
- The current GM Difference operation just does a per-channel difference, not an alpha blend. I've reimplemented it, but if you wanted the straight difference you could rename the operation. IM's Difference operation is the alpha-blending one.
- The formulas behind Subtract and Divide are unclear. IM's don't match Photoshop's, and the current GM implementations don't match either one.