Code Monkey home page Code Monkey logo

lambda-watermark's Introduction

lambda-watermark (forked)

This module places a watermark in the chosen position of your image. An S3 Lambda event can be used to watermark every image that is uploaded to S3 and to save it as an altered version retaining the original file.

Note: this is a forked version of lamda-watermark which is a forked version of lamda-watermark. Changes features include:

  • ability to position water mark
  • ability to set the permissions of your created file
  • set destination S3 bucket and path
  • save a version of the file as '-watermarked' to retain the original
  • logging

How to use

  • npm install --save tyroga/lambda-watermark
  • Create your function (index.js)
'use strict'
var LambdaWatermark = require('lambda-watermark')

var options = {
  watermarkImagePath: './exampleWatermark.png',
  relativeSize: 5,
  watermarkWidth: 250,
  watermarkHeight: 133,
  opacity: 50,
  watermarkedImageACL: 'public-read'
}

exports.handler = function(event, context) {
  console.log('๐Ÿšจ New image detected!')
  new LambdaWatermark(options)(event, context)
}
  • Set up Lambda service on AWS
  • Zip up your directory (index.js, watermark image, and node_modules) and upload to your AWS Lambda function
  • specify the destination bucket as an environment variable

Configuration (options)

  • watermarkImagePath: The relative path to your image
  • watermarkWidth: Width of the watermark image
  • watermarkHeight: Height of the watermark image
  • relativeSize: The size of the watermark (percent relative to the parent image)
  • opacity: How opaque the watermark should be. (100 is fully opaque, 0 is fully transparent)
  • position: Where the watermark should be located on the image. (options are NorthWest|North|NorthEast|West|Center|East|SouthWest|South|SouthEast)
  • watermarkedImageACL: ACL permissions on the final, watermarked image (i.e. 'public-read')

lambda-watermark's People

Contributors

prestonvanloon avatar markadamfoster avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.