Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant