Closed jacobtomlinson closed 9 years ago
Hey! Good to hear you liked the library.
Actually it should handle the transparency correctly. So, could you provide some sample files and code? I can take a look and just fix that.
Yeah no problem, I'll just get you some example code.
input.png smiley.png
var outStream = fs.createWriteStream('/tmp/output.png')
fs.createReadStream('/tmp/input.png')
.pipe(gd.watermark('/tmp/smiley.png', {x: 1, y: 0.9}))
.pipe(outStream)
output.png
Any update on this? Thanks!
Bump
@jacobtomlinson sorry man, was busy the whole weekend. Will take a look tonight.
Awesome thanks!
Great thank you very much.
You are welcome! The updated version is already available via npm.
By the way, your smiley.png has a white opaque background, which was kinda confusing :) Anyway, now that works:
var gd = require('./index.js'),
fs = require('fs')
var outStream = fs.createWriteStream('out.png')
fs.createReadStream('in.png')
.pipe(gd.watermark( gd.open('in.png').resize({width: 200, height: 200}) ))
.pipe(gd.watermark('s.png'))
.pipe(outStream)
Ah thanks. I just grabbed that smiley off the interwebs for the example, I'm not actually using it.
Thanks for this library, it's great!
One problem I've found when adding watermarks to PNGs with transparency is that the transparency turns black.
Any ideas on how to fix this?