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

How can i specify the watermark image? #276

Open
ptgamr opened this issue Apr 28, 2014 · 7 comments
Open

How can i specify the watermark image? #276

ptgamr opened this issue Apr 28, 2014 · 7 comments
Labels

Comments

@ptgamr
Copy link

ptgamr commented Apr 28, 2014

Hi there,

Documentation say: gm("img.png").watermark(brightness, saturation)

I wonder how to specify which image should be added as watermark?

Thanks for any help!

@desigens
Copy link
Contributor

As you can see in GraphicsMagic documentation (http://www.graphicsmagick.org/composite.html)
-watermark is just option for powerful composite utility.

I recommend to google with keywords "GraphicsMagic" or "Imagemagick" and to try command line first of all:

gm composite -watermark 50x50 image.jpg watermark.png output.jpg

After that using gm is more simple ;-)

@dimitarkolev
Copy link

Can you provide an example... its not that easy to understand the relation between GraphicsMagic and gm and there is no single example about composite and gm.

@rwky rwky added the question label Apr 9, 2015
@madbence
Copy link

madbence commented Jun 8, 2015

@ptgamr @dimitarkolev I'm not sure if this is till an issue for you guys, but I create watermarked images with this pattern:

gm(source)
  .command('composite')
  .gravity('SouthEast')
  .out('-geometry', '+20+10') // offset
  .in('watermark.png')
  .stream()
  .pipe(dest);

@dimitarkolev
Copy link

10x I'll try this.
On Jun 8, 2015 14:19, "Bence Dányi" [email protected] wrote:

@ptgamr https://github.com/ptgamr @dimitarkolev
https://github.com/dimitarkolev I'm not sure if this is till an issue
for you guys, but I create watermarked images with this pattern:

gm(source)
.command('composite')
.gravity('SouthEast')
.out('-geometry', '+20+10') // offset
.in('watermark.png')
.stream()
.pipe(dest);


Reply to this email directly or view it on GitHub
#276 (comment).

@digz6666
Copy link

@madbence Thank you it worked! I was trying following way, but didn't know how to specify watermark location.

gm(readStream)
.autoOrient()
.resize(1280, 1024)
.gravity('SouthEast')
.draw('image Over 10,10 0,0 ' + getAppPath() + '/public/img/watermark.png')
.stream('PNG')
.pipe(writeStream);

@damogallagher
Copy link

Hi

Is it possible to specify a buffer (e.g. from a file upload) for the watermark instead of the physical file on a server?

Thanks
Damien

@Security111588
Copy link

gm('./background.jpg')
  .autoOrient()
  .resize(1000, 1000)
  .draw("image Over 100,300 0,0 './logo.png'")
  .write('./img/backgroundwithlogo.png', function(err) {
    if (!err) console.log('done');
  });

this code is worked for me.
100,300 is watermark location.
@digz6666

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

No branches or pull requests

8 participants