From Directorforum Collaboration Wiki
--c := a + 2*b - 256;
--if c < 0 then
-- result := 0
--else if c > 255 then
-- result := 255
--else
-- result := c;
-- ******* stamp mode *************
on stampBlendMode (image1, image2)
theWidth = image1.width - 1
theHeight = image1.height - 1
theImage = image(theWidth + 1, theHeight + 1, 32)
repeat with x = 0 to theWidth
repeat with y = 0 to theHeight
theColour1 = image1.getPixel(point(x,y))
theColour2 = image2.getPixel(point(x,y))
theNewColour = color(0,0,0)
theNewColour.red = max(min(theColour1.red + (2 * theColour2.red) - 256, 255), 0)
theNewColour.green = max(min(theColour1.green + (2 * theColour2.green) - 256, 255), 0)
theNewColour.blue = max(min(theColour1.blue + (2 * theColour2.blue) - 256, 255), 0)
theImage.setPixel(point(x, y), theNewColour)
end repeat
end repeat
return theImage
end