gm icon indicating copy to clipboard operation
gm copied to clipboard

A way to use Distortion?

Open thorwil opened this issue 5 years ago • 0 comments

I’m not sure if this is just a translation issue, or if gm doesn’t support Distort correctly. “-compose Distort” is only in imagemagick, not in graphicsmagick.

This shell code distorts an image “content” with a map as described at http://www.imagemagick.org/Usage/mapping/#distortion_unified

convert "$content" \
        -resize "$size"\! \
        -matte "$map" \
        -compose Distort -composite "$output"

My attempt to translate that:

gm(content).resize(size)
    //.matte(map) doesn’t seem to have an effect, no matter the order
    .compose("Distort")
    .composite(map)
    .write(output, function (err) {
        if (err) {
           reject(err);
        } else {
           console.log("Content rendered.")
           resolve();
        }

The result has the original canvas size and the distortion is wrong, in that one area is stretched.

So, is there an shortcoming of gm, or is there a way to translate the shell version correctly?

thorwil avatar Nov 09 '20 19:11 thorwil