watermark

package module
v0.0.0-...-8569997 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2018 License: GPL-2.0 Imports: 8 Imported by: 0

README

GoWatermark

Go package "watermark" applies a specified logo in a configurable position and creates a new file from the original.

Usage

See the 'example' directory
  1. Run git clone https://github.com/collinux/watermark
  2. Run go run watermark.go <path_to_image> with the path being jpg/jpeg file
  3. A new image will be created from the original named "<image_name>_watermark.jpg" (does not override original)
Library
  1. Run go get github.com/collinux/watermark
  2. Add import github.com/collinux/watermark
  3. Create a new Watermark struct with the configuration of your choice (only source is required by default)
  4. Call watermark.Apply(<filename>) with the file that you want to place the watermark onto
Example
logo := watermark.Watermark{Source: "~/Pictures/my_logo.png"}
logo.Apply("~/Pictures/gopherart.jpg")

Remember to import "github.com/collinux/watermark"

License

Copyright (C) 2016 Collinux GPL version 2 or higher http://www.gnu.org/licenses/gpl.html

Contributing

Pull requests happily accepted on GitHub!

Documentation

Index

Constants

View Source
const (
	CENTER       = 0
	TOP_LEFT     = 1
	TOP_RIGHT    = 2
	BOTTOM_LEFT  = 3
	BOTTOM_RIGHT = 4
)

Watermark quadrant position

Variables

This section is empty.

Functions

This section is empty.

Types

type Watermark

type Watermark struct {
	Source string

	// Placement of watermark image (default: bottom right)
	Position int

	// Margin around the watermark image (all default to 0)
	PaddingTop    int
	PaddingLeft   int
	PaddingRight  int
	PaddingBottom int
}

func (*Watermark) Apply

func (w *Watermark) Apply(file string) error

Apply a watermark on a file given the absolute path. Requires watermark.Source specified

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL