{"id":16848314,"url":"https://github.com/vinaygaba/rubberstamp","last_synced_at":"2025-04-07T06:13:32.452Z","repository":{"id":34755094,"uuid":"38736227","full_name":"vinaygaba/RubberStamp","owner":"vinaygaba","description":"📫 RubberStamp is an Android library that makes it easy for you to add a watermark to your images.","archived":false,"fork":false,"pushed_at":"2017-07-04T23:34:52.000Z","size":20749,"stargazers_count":417,"open_issues_count":7,"forks_count":70,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-31T05:06:39.426Z","etag":null,"topics":["android","android-library","java","rubberstamp","watermark","watermark-image"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vinaygaba.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-08T06:26:21.000Z","updated_at":"2025-01-10T17:39:06.000Z","dependencies_parsed_at":"2022-09-15T06:20:45.216Z","dependency_job_id":null,"html_url":"https://github.com/vinaygaba/RubberStamp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinaygaba%2FRubberStamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinaygaba%2FRubberStamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinaygaba%2FRubberStamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinaygaba%2FRubberStamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinaygaba","download_url":"https://codeload.github.com/vinaygaba/RubberStamp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601449,"owners_count":20964864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","java","rubberstamp","watermark","watermark-image"],"created_at":"2024-10-13T13:10:50.329Z","updated_at":"2025-04-07T06:13:32.408Z","avatar_url":"https://github.com/vinaygaba.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"RubberStamp :mailbox:\n================\n\n![Feature Image](images/FeatureImage.png)\n\nRubberStamp is an Android library that makes it easy for you to watermark your images.\n\n![Screenshots](images/rubberstamp_sample.gif)\n\n\nFeatures\n---------\n\n* Add a watermark to your images.\n* It can be text or another image.\n* Multiple ways and features to customize how the watermark looks including attributes like font, color, opacity, size, shadow properties, etc.\n* Flexible API that has multiple pre-defined options to get started quickly.\n* Ability to tile your watermark across an image.\n\n\nSetup\n------\nThe library is pushed to Maven Central as an AAR, so you just need to add the following to your build.gradle file:\n```java\ndependencies {\n    compile ‘com.vinaygaba:rubberstamp:1.0.0’\n}\n```\n\nUsage\n------\nUsing RubberStamp is extremely easy.\n\nFirst, define the characteristics of your watermark using RubberStampConfig\n\n```java\nRubberStampConfig config = new RubberStampConfigBuilder()\n              .base(R.drawable.lenna)\n              .rubberStamp(\"Watermark\")\n              .rubberStampPosition(RubberStamp.CENTER)\n              .alpha(100)\n              .margin(30, 30)\n              .rotation(-45)\n              .textColor(Color.BLACK)\n              .textBackgroundColor(Color.WHITE)\n              .textShadow(0.1f, 5, 5, Color.BLUE)\n              .textSize(90)\n              .textFont(\"fonts/champagne.ttf\");\n              .build();\n```\n\nThat'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!\n```java\nRubberStamp rubberStamp = new RubberStamp(this);\nrubberStamp.addStamp(config);\n```\n\nAttribute Usage \u0026 Documentation\n--------------------------------\nAll the attributes listed below are part of RubberStampConfig.\n\n##### I. `base`\nUse this to set the base image on top of which the watermark will be drawn. This can be a bitmap or a drawable.\n\n```java\nconfig.base(bitmap);\n\nconfig.base(R.id.image);\n```\n\n##### II. `rubberStamp`\nThe rubberstamp is the actual watermark that will be drawn on top of the base image. This can either be a bitmap or a string.\n\n```java\n// String watermark\nconfig.rubberStamp(\"Watermark\" );\n```\n\u003cimg src=\"images/rubberstamp1.png\" width=\"300\"\u003e\n\n```java\n// Bitmap watermarkBitmap\nconfig.rubberStamp(bitmap);\n```\n\u003cimg src=\"images/rubberstamp2.png\" width=\"300\"\u003e\n\nIf you want to use a drawable, convert it to a bitmap and use that. You would do that using:\n\n```java\nBitmap bitmap = BitmapFactory.decodeResources(getResources(), R.drawable.logo);\n\n```\n\n##### III. `rubberStampPosition`\nThe library provides 9 pre defined positions to display the location of the rubberstamp. They are as follows:\n\nTOP_LEFT\u003cbr/\u003e\nTOP_CENTER\u003cbr/\u003e\nTOP_RIGHT\u003cbr/\u003e\nBOTTOM_LEFT\u003cbr/\u003e\nBOTTOM_CENTER\u003cbr/\u003e\nBOTTOM_RIGHT\u003cbr/\u003e\nCENTER_LEFT\u003cbr/\u003e\nCENTER\u003cbr/\u003e\nCENTER_RIGHT\u003cbr/\u003e\n\n```java\n// RubberStampPosition position\nconfig.rubberStampPosition(RubberStampPosition.BOTTOM_RIGHT);\n\n```\n\u003cimg src=\"images/rubberStampPosition.png\" width=\"300\"\u003e\n\nIn 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.\n\n```java\n// RubberStampPosition position, int xCoordinate, int yCoordinate\nconfig.rubberStampPosition(RubberStampPosition.CUSTOM, 100, 100);\n```\n\nThere is another special position, `TILE` that you can use in order to tile the rubberstamp across the base image.\nThis is a fairly common use case for watermarking software so it made sense for the library\nto support it. You can use it in the following way:\n\n```java\n// RubberStampPosition position\nconfig.rubberStampPosition(RubberStampPosition.TILE);\n```\n\u003cimg src=\"images/tiling.png\" width=\"300\"\u003e\n\n##### IV. `alpha`\n\nUse alpha to change the opacity of your rubberstamp. It accepts an int value between 0 and 255.\n\n```java\n//int alpha\nconfig.alpha(255);\n```\n\u003cimg src=\"images/textAlpha.png\" width=\"300\"\u003e\n\n##### V. `rotation`\n\nRotation does exactly what you'd imagine it to: it rotates your rubberstamp. It expects a float value\nto be passed to it.\n\n```java\nconfig.rotation(45);\nconfig.rotation(-45);\n```\n\u003cimg src=\"images/rotation.png\" width=\"300\"\u003e\n\n##### VI. `margin`\nMargin lets you specify the x \u0026 y offset for your rubberstamp after you have selected its RubberStampPosition.\nThis 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.\n\n```java\n// int xMargin, int yMargin\nconfig.margin(-30, 30);\n```\n### Text RubberStamp specific attributes\n\nThere are some additional attributes that this library provides when you pass a String as the RubberStamp.\nThese attributes won't have any side effects when you pass a bitmap as a rubberstamp and will be disregarded.\nMost of them are pretty self explanatory.\n\n##### VII. `textColor`\n\nSets the text color of the rubberstamp.\n```java\nconfig.textColor(Color.parseColor(\"#FFB6C1\"));\n```\n\u003cimg src=\"images/textColor.png\" width=\"300\"\u003e\n\n##### VIII. `textBackgroundColor`\n\nThis lets you specify a background color for your text rubberstamp.\n\n\u003cb\u003eNote\u003c/b\u003e This attribute does not work when the position is set to RubberStampPosition.TILE\n\n```java\n//int color\nconfig.textBackgroundColor(Color.WHITE);\n```\n\u003cimg src=\"images/textBackground.png\" width=\"300\"\u003e\n\n##### IX. `textSize`\nSets the size of the text rubberstamp.\n\n```java\n//int size\nconfig.textSize(40);\n```\n\u003cimg src=\"images/textSize.png\" width=\"300\"\u003e\n\n##### X. `textShader`\n\nThis lets you specify a custom shader that you can use to customize the watermark.\nHonestly, the sky is the limit when it comes to Shaders. Here is an example shader that\npaints my watermark in rainbow colors.\n\n```java\nRubberStamp rubberStamp = new RubberStamp(this);\nint[] rainbow = {Color.RED, Color.YELLOW, Color.GREEN, Color.BLUE, Color.MAGENTA};\nShader shader = new LinearGradient(0, 0, 0, logo.getWidth(), rainbow,\n        null, Shader.TileMode.MIRROR);\nMatrix matrix = new Matrix();\nmatrix.setRotate(90);\nshader.setLocalMatrix(matrix);\n\n//set the shader\nconfig.textShader(shader);\n```\n\u003cimg src=\"images/textShader.png\" width=\"300\"\u003e\n\n##### XI. `textShadow`\nThis lets you specify a shadow for your text rubberstamp.\n\u003cb\u003eNote:\u003c/b\u003e No shadow will be displayed if the blur radius is set to 0. This is how the paint\nAPI in Android behaves underneath as well.\n```java\n//float blurRadius, float xOffset, float yOffset, int color\nconfig.textShadow(1.0f, 5, 5, Color.BLUE);\n```\n\u003cimg src=\"images/textShadow.png\" width=\"300\"\u003e\n\n##### XII. `textFont`\nUse this to specify a custom font for your text rubberstamp.\n\n```java\n//String fontpath\nconfig.textFont(\"fonts/champagne.ttf\");\n```\n\u003cimg src=\"images/textFont.png\" width=\"300\"\u003e\n\nCredits\n-----------------\nAuthor: Vinay Gaba (vinaygaba@gmail.com)\n\n\u003ca href=\"https://plus.google.com/+Vinaygaba\"\u003e\n  \u003cimg alt=\"Follow me on Google+\"\n       src=\"https://github.com/gabrielemariotti/cardslib/raw/master/demo/images/g+64.png\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://twitter.com/vinaygaba\"\u003e\n  \u003cimg alt=\"Follow me on Twitter\"\n       src=\"https://github.com/gabrielemariotti/cardslib/raw/master/demo/images/twitter64.png\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://www.linkedin.com/in/vinaygaba\"\u003e\n  \u003cimg alt=\"Follow me on LinkedIn\"\n       src=\"https://github.com/gabrielemariotti/cardslib/raw/master/demo/images/linkedin.png\" /\u003e\n\u003c/a\u003e\n\n\nLicense\n-------\n\n    Copyright 2017 Vinay Gaba\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinaygaba%2Frubberstamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinaygaba%2Frubberstamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinaygaba%2Frubberstamp/lists"}