All Projects → vinaygaba → Rubberstamp

vinaygaba / Rubberstamp

📫 RubberStamp is an Android library that makes it easy for you to add a watermark to your images.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Rubberstamp

pdfconduit
Prepare documents for distribution
Stars: ✭ 22 (-94.65%)
Mutual labels:  watermark
watermarker
A little tool use to add watermark to image.
Stars: ✭ 17 (-95.86%)
Mutual labels:  watermark
Stegastamp
Invisible Hyperlinks in Physical Photographs
Stars: ✭ 306 (-25.55%)
Mutual labels:  watermark
SLBR-Visible-Watermark-Removal
[ACM MM 2021] Visible Watermark Removal via Self-calibrated Localization and Background Refinement
Stars: ✭ 54 (-86.86%)
Mutual labels:  watermark
imagor
Fast, Docker-ready image processing server in Go and libvips
Stars: ✭ 2,276 (+453.77%)
Mutual labels:  watermark
pylovepdf
ilovepdf.com python API library
Stars: ✭ 52 (-87.35%)
Mutual labels:  watermark
Tiktok-Video-No-Watermark
Tiktok Video Without Watermark.Tiktok短视频去水印。
Stars: ✭ 49 (-88.08%)
Mutual labels:  watermark
Imaginary
Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing
Stars: ✭ 4,107 (+899.27%)
Mutual labels:  watermark
lambda-watermark
AWS Lambda Watermark service for S3 images
Stars: ✭ 20 (-95.13%)
Mutual labels:  watermark
Kbase Doc
文档在线预览编辑,文档水印 / Office files preview or edit online, doc/docx convert to html, watermark
Stars: ✭ 275 (-33.09%)
Mutual labels:  watermark
watermark
简单的图片水印功能,支持 GIF
Stars: ✭ 38 (-90.75%)
Mutual labels:  watermark
Watermark-Bot
A Telegram Video Watermark Adder Bot in Pyrogram by @AbirHasan2005
Stars: ✭ 82 (-80.05%)
Mutual labels:  watermark
hack scripts
Usefull scripts
Stars: ✭ 51 (-87.59%)
Mutual labels:  watermark
WebRtcShitBlt
client side WebRTC lib to add an image / watermark on the MediaSource
Stars: ✭ 19 (-95.38%)
Mutual labels:  watermark
Mcanvas
用于合成图片的canvas绘制库
Stars: ✭ 343 (-16.55%)
Mutual labels:  watermark
ImageResize
Image resizing tool for .Net applications with ability to add text/image watermark, Supports animated images as well.
Stars: ✭ 45 (-89.05%)
Mutual labels:  watermark
tiktok-downloader
Tiktok Downloader/Scraper using requests & bs4
Stars: ✭ 47 (-88.56%)
Mutual labels:  watermark
Nowatermark
remove watermark. 去除图片中的水印
Stars: ✭ 373 (-9.25%)
Mutual labels:  watermark
Blind Watermark
Watermark added to the frequency domain by Fourier transform
Stars: ✭ 344 (-16.3%)
Mutual labels:  watermark
watermark-enhancer
Add watermark to react components in a more elegant way
Stars: ✭ 66 (-83.94%)
Mutual labels:  watermark

RubberStamp 📫

Feature Image

RubberStamp is an Android library that makes it easy for you to watermark your images.

Screenshots

Features

  • Add a watermark to your images.
  • It can be text or another image.
  • Multiple ways and features to customize how the watermark looks including attributes like font, color, opacity, size, shadow properties, etc.
  • Flexible API that has multiple pre-defined options to get started quickly.
  • Ability to tile your watermark across an image.

Setup

The library is pushed to Maven Central as an AAR, so you just need to add the following to your build.gradle file:

dependencies {
    compile com.vinaygaba:rubberstamp:1.0.0
}

Usage

Using RubberStamp is extremely easy.

First, define the characteristics of your watermark using RubberStampConfig

RubberStampConfig config = new RubberStampConfigBuilder()
              .base(R.drawable.lenna)
              .rubberStamp("Watermark")
              .rubberStampPosition(RubberStamp.CENTER)
              .alpha(100)
              .margin(30, 30)
              .rotation(-45)
              .textColor(Color.BLACK)
              .textBackgroundColor(Color.WHITE)
              .textShadow(0.1f, 5, 5, Color.BLUE)
              .textSize(90)
              .textFont("fonts/champagne.ttf");
              .build();

That's all that is needed really. All you need to do next is just pass this config to the addStamp method of the RubberStamp class and voila!

RubberStamp rubberStamp = new RubberStamp(this);
rubberStamp.addStamp(config);

Attribute Usage & Documentation

All the attributes listed below are part of RubberStampConfig.

I. base

Use this to set the base image on top of which the watermark will be drawn. This can be a bitmap or a drawable.

config.base(bitmap);

config.base(R.id.image);
II. rubberStamp

The rubberstamp is the actual watermark that will be drawn on top of the base image. This can either be a bitmap or a string.

// String watermark
config.rubberStamp("Watermark" );
// Bitmap watermarkBitmap
config.rubberStamp(bitmap);

If you want to use a drawable, convert it to a bitmap and use that. You would do that using:

Bitmap bitmap = BitmapFactory.decodeResources(getResources(), R.drawable.logo);

III. rubberStampPosition

The library provides 9 pre defined positions to display the location of the rubberstamp. They are as follows:

TOP_LEFT
TOP_CENTER
TOP_RIGHT
BOTTOM_LEFT
BOTTOM_CENTER
BOTTOM_RIGHT
CENTER_LEFT
CENTER
CENTER_RIGHT

// RubberStampPosition position
config.rubberStampPosition(RubberStampPosition.BOTTOM_RIGHT);

In additon, if you would like to specify the exact position of the rubberstamp, you can pass the the RubberStampPosition to be CUSTOM and use the following constructor to specify the position.

// RubberStampPosition position, int xCoordinate, int yCoordinate
config.rubberStampPosition(RubberStampPosition.CUSTOM, 100, 100);

There is another special position, TILE that you can use in order to tile the rubberstamp across the base image. This is a fairly common use case for watermarking software so it made sense for the library to support it. You can use it in the following way:

// RubberStampPosition position
config.rubberStampPosition(RubberStampPosition.TILE);
IV. alpha

Use alpha to change the opacity of your rubberstamp. It accepts an int value between 0 and 255.

//int alpha
config.alpha(255);
V. rotation

Rotation does exactly what you'd imagine it to: it rotates your rubberstamp. It expects a float value to be passed to it.

config.rotation(45);
config.rotation(-45);
VI. margin

Margin lets you specify the x & y offset for your rubberstamp after you have selected its RubberStampPosition. This is to give the user the ability to position his rubberstamp at a more precise location if the defaults RubberStampPosition presets are not good enough.

// int xMargin, int yMargin
config.margin(-30, 30);

Text RubberStamp specific attributes

There are some additional attributes that this library provides when you pass a String as the RubberStamp. These attributes won't have any side effects when you pass a bitmap as a rubberstamp and will be disregarded. Most of them are pretty self explanatory.

VII. textColor

Sets the text color of the rubberstamp.

config.textColor(Color.parseColor("#FFB6C1"));
VIII. textBackgroundColor

This lets you specify a background color for your text rubberstamp.

Note This attribute does not work when the position is set to RubberStampPosition.TILE

//int color
config.textBackgroundColor(Color.WHITE);
IX. textSize

Sets the size of the text rubberstamp.

//int size
config.textSize(40);
X. textShader

This lets you specify a custom shader that you can use to customize the watermark. Honestly, the sky is the limit when it comes to Shaders. Here is an example shader that paints my watermark in rainbow colors.

RubberStamp rubberStamp = new RubberStamp(this);
int[] rainbow = {Color.RED, Color.YELLOW, Color.GREEN, Color.BLUE, Color.MAGENTA};
Shader shader = new LinearGradient(0, 0, 0, logo.getWidth(), rainbow,
        null, Shader.TileMode.MIRROR);
Matrix matrix = new Matrix();
matrix.setRotate(90);
shader.setLocalMatrix(matrix);

//set the shader
config.textShader(shader);
XI. textShadow

This lets you specify a shadow for your text rubberstamp. Note: No shadow will be displayed if the blur radius is set to 0. This is how the paint API in Android behaves underneath as well.

//float blurRadius, float xOffset, float yOffset, int color
config.textShadow(1.0f, 5, 5, Color.BLUE);
XII. textFont

Use this to specify a custom font for your text rubberstamp.

//String fontpath
config.textFont("fonts/champagne.ttf");

Credits

Author: Vinay Gaba ([email protected])

Follow me on Google+ Follow me on Twitter Follow me on LinkedIn

License

Copyright 2017 Vinay Gaba

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].