Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Any way to composite a current GraphicsMagick object onto another image? #851

Open
rjindael opened this issue Dec 25, 2022 · 0 comments
Open

Comments

@rjindael
Copy link

Hi, I was wondering if there's a way to compose the current GraphicsMagick object onto another image. Currently, the way I do it is like so:

const fs = require("fs")
const gm = require("gm")

let overlay = gm(1280, 720, "#FFFFFF")

// ... add text to image, etc ...

// now to put *this* image on top of *another* image
// currently I write this image to a temporary file, and then call composite

overlay.write("image_overlay.png")
let underlay = gm("underlay_template.png")
underlay.composite("image_overlay.png")
underlay.write("image.png")
fs.rmSync("image_overlay.png")

The reason the underlay has to be separate from the underlay template image is due to the fact that I need to call functions such as raise and such on the overlaying image (i.e. specific effects to the overlay layer.) I'm not sure if I'm missing anything, but please correct me if I am.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant