I noticed someone referring to my junk on the Mathworks FEX, so I figured I’d touch on some of the questions and comments here and on Phabricator.
Regarding intent and utility of particular modes:
We need to differentiate between general classes of working images. Consider images such as photographs and life drawings or paintings. These referential images depict objects of which the viewer has some abstract preconceptions. To apply drastic changes (e.g. local intensity inversions or hue rotation) will result in an image which is at odds with the expected perception of the objects or image space. As I’ve said elsewhere, seeing a person with a purple face doesn’t make any sense to a pattern-recognition machine built on earth. It’s easy to see many of these modes as horribly useless when considering this sort of application.
As the MIMT is heavily focused on image analysis, obfuscation, and the generation of abstract images, many of the blend modes featured in IMBLEND are tailored for use on images which are non-referential. Blending two wholly abstract image fields in ridiculous or entirely random manners does not produce the same objectionable response in the viewer as it would with photographic content. To the point of image analysis, also consider that many blend modes are simply more utilitarian tools than aesthetically important effects. Consider modes such as ‘difference’, ‘divide’, ‘exclusion’ and many of the other modes in the “mathematical” or “arithmetic” category.
I’m hesitant to try rationalizing propriety based on the assumption that all users are painters or that all content is referential. If a superabundance of blending modes is seen as a problem for users who only need the “big five”, then I’m inclined to say that the solution is a user-configurable menu instead of restricted availability. I’m driven to that opinion, as IMBLEND was my way of getting tools that Krita and GIMP did not offer.
Regarding ‘bomb’ modes:
To understand ‘bomb’, first understand ‘mesh’. Consider the image of contour maps linked above. Intuitively, these contours describe a height map – or surface, which in turn represents a transfer function mapping two inputs to a single output within a unit cube. Consider any particular intuitive blend mode such as ‘average’. While this planar surface is normally expressed algebraically, we can instead approximate it using a 2-D map of arbitrary resolution and some interpolation. Given enough resolution and a means to directly apply this representative map as a transfer function, we can approximate any blend mode using a single common approach.
In IMBLEND, the ‘overlay’ and ‘hardlight’ complements use this mesh method to produce fractional iteratives of the named blend instead of doing expensive iterated algebraic blending. Besides improving computational efficiency (keep in mind that I’m operating in Matlab), the big benefit to this approach is that it allows the application of arbitrary or adjustable blends without needing to derive an algebraic expression. A user who can intuit a contour map can easily generate their own or adapt one from an existing algebraic mode.
The ‘bomb’ modes are a demonstration of both concepts discussed here. These modes simply generate random surfaces to apply as if they were transfer functions. The resolution can be specified via an extra AMOUNT parameter, and the interpolation is rolled into the case (‘bomb’ uses linear interpolation; ‘hardbomb’ uses nearest-neighbor interpolation). These modes are almost exclusively useful for operating on abstract non-referential images. The name implies what they conceptually do to the object content in referential images. It’s worth noting that in IMBLEND, this random transfer function is volatile. Invoking the blend routine again will produce different results.
For a single-channel image, we can reduce ‘bomb’ to the pseudocode:
% generate reference grids to describe the domain of the transfer function
c=0:1/amount:1;
[gridb gridf]=meshgrid(c,c);
% generate a random square transfer function of specified size
tf = rand([amount amount]);
% stretch range of tf to fill the unit interval
mn = globalmin(tf);
mx = globalmax(tf);
tf = (tf-mn)/(mx-mn);
% do 2D interpolation using grids, transfer function, and input image data
result = interp2(gridb,gridf,tf,BG,FG,'bilinear');
Now we come to what I feel is one of the most important and unique aspects of IMBLEND, and what I feel is one of the biggest limitations in trying to apply some of its modes elsewhere. IMBLEND provides an extra scaling/configuration parameter for many blend modes. To my knowledge, this is not something implemented in Krita/GIMP or elsewhere. I don’t need to go on about why I think it’s useful; simply understand that I do, and understand that many of these blend modes owe their existence to the availability of that scaling/configuration parameter. Without the ability to specify the resolution of the mesh used in ‘bomb’, it becomes very difficult to use. The ‘mesh’ mode uses this configuration parameter as its means of accepting captured or user-derived transfer functions. Without an extra parameter, ‘mesh’ loses its primary utility, and ‘bomb’ is difficult and its results are volatile.
Regarding quadratic modes:
I’m surprised anyone is considering these. For what it’s worth, I think that ‘easydodge’, ‘easyburn’, and ‘flatlight’ have broader utility. The fact that most quadratic modes are largely saturated (i.e. a large percentage of their domain maps to either 1 or 0) makes them difficult to use except in the non-referential universe. As an aside, handling infinite slope at the steep corners is kind of a gamble; I can’t say my choices are definitive or even appropriate. Some of these modes will produce complex-valued output if their input range extends beyond [0 1] (don’t know if that’s even a problem in your environment).
Wherein I stop:
I’ve been on a long dry spell from painting and drawing, and my experience with Krita is limited. I’m curious to see what has been added. I’m curious if anyone has had a chance to run some images through IMCOMPOSE. It’s not exactly a friendly UI, and I doubt anyone wants to deal with Matlab, but it might be convenient to just browse the blends with your own familiar test images to see if they’re of any use or to see if the parameterization is of value.