Hate to answer my own question, but I seem to have solved it.
It looks like I was trying to be too clever, but after reading the docs a few more times I think I was getting confused with the how the +swap
and composite
method interact.
As I understand it, the +swap
ensures that instead of the blurred image getting composited on the greyscale image, now the greyscale image gets composited on top of the blurred image.
Once this clicked, the script looks much simpler:
process :do_stuff
def do_stuff
manipulate! do |img|
img.colorspace = Magick::GRAYColorspace
blur = img.clone.blur_image(0,10)
img = blur.composite(img,Magick::CenterGravity,Magick::DivideCompositeOp)
img = img.linear_stretch('5%','0%')
end
end
And that seems to produce the same results as my original ImageMagick script.