trustmark


Nametrustmark JSON
Version 0.5.3 PyPI version JSON
download
home_pagehttps://github.com/adobe/trustmark
SummaryTrustMark: Universal Watermarking for Arbitrary Resolution Images
upload_time2024-02-19 19:54:14
maintainer
docs_urlNone
authorTu Bui, Shruti Agarwal, John Collomosse
requires_python>=3.8.5
licenseCopyright 2023 Adobe All Rights Reserved. NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms of the license agreement accompanying it. MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords watermarking cai watermark content authenticity initiative provenance
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TrustMark - Universal Watermarking for Arbitrary Resolution Images

An Open Source, MIT licensed implementation of TrustMark watemarking for the Content Authenticity Initiative (CAI) as described in: 

**TrustMark - Universal Watermarking for Arbitrary Resolution Images**

https://arxiv.org/abs/2311.18297 

[Tu Bui](https://www.surrey.ac.uk/people/tu-bui) <sup>1</sup>, [Shruti Agarwal](https://research.adobe.com/person/shruti-agarwal/)  <sup>2</sup> , [John Collomosse](https://www.collomosse.com)  <sup>1,2</sup> 

<sup>1</sup> DECaDE Centre for the Decentralized Digital Economy, University of Surrey, UK. \
<sup>2</sup> Adobe Research, San Jose CA.


This repo contains a Python (3.8.5 or higher) (`python/`)and a browser deployable Javascript (`js/`) implementation of 
TrustMark for  encoding, decoding and removing image watermarks.  In addition, a C2PA (`c2pa/`) example is provided to 
demonstrate signing of a watermarked image using the CAI supplied python library for C2PA / Content Credentials.



### Quick start for Python

Within the python folder run `pip install .` \
The TrustMark package is also available via PyPi - run `pip install trustmark` to install it indepedent of this repo.

The `python/test.py` script provides examples of watermarking images (a JPEG and a transparent PNG image are provided as examples).  To test the installation the following code snippet in Python shows typical usage:

```python
from trustmark import TrustMark
from PIL import Image

# init
tm=TrustMark(verbose=True, model_type='Q')

# encoding example
cover = Image.open('ufo_240.jpg').convert('RGB')
tm.encode(cover, 'mysecret').save('ufo_240_Q.png')

# decoding example
cover = Image.open('ufo_240_Q.png').convert('RGB')
wm_secret, wm_present, wm_schema = tm.decode(cover)
if wm_present:
  print(f'Extracted secret: {wm_secret}')
else:
  print('No watermark detected')

# removal example
stego = Image.open('ufo_240_Q.png').convert('RGB')
im_recover = tm.remove_watermark(stego)
im_recover.save('recovered.png')
```


### TrustMark Models

Models are now fetched on first use, due to the number of variants and size of models they are not packaged as binary any more.

### CUDA troubleshoot

The following clean install should work for getting up and running on GPU using the python implementation in this repo.

```
conda create --name trustmark python=3.10
conda activate trustmark
conda install pytorch cudatoolkit=12.8 -c pytorch -c conda-forge
pip install torch==2.1.2 torchvision==0.16.2 -f https://download.pytorch.org/whl/torch_stable.html
pip install .
```

## Citation

If you find this work useful we request you please cite the repo and/or TrustMark paper as follows.

```
@article{trustmark,
  title={Trustmark: Universal Watermarking for Arbitrary Resolution Images},
  author={Bui, Tu and Agarwal, Shruti and Collomosse, John},
  journal = {ArXiv e-prints},
  archivePrefix = "arXiv",
  eprint = {2311.18297},
  year = 2013,
  month = nov
}
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/adobe/trustmark",
    "name": "trustmark",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.5",
    "maintainer_email": "John Collomosse <collomos@adobe.com>",
    "keywords": "watermarking,CAI,watermark,Content Authenticity Initiative,provenance",
    "author": "Tu Bui, Shruti Agarwal, John Collomosse",
    "author_email": "Tu Bui <t.v.bui@surrey.ac.uk>, Shruti Agarwal <shragarw@adobe.com>, John Collomosse <collomos@adobe.com>",
    "download_url": "https://files.pythonhosted.org/packages/10/4a/ae2e91da1d6d34f7d6c0677e447171d641b69ed2b3ee5c3c65eb084d4624/trustmark-0.5.3.tar.gz",
    "platform": null,
    "description": "# TrustMark - Universal Watermarking for Arbitrary Resolution Images\n\nAn Open Source, MIT licensed implementation of TrustMark watemarking for the Content Authenticity Initiative (CAI) as described in: \n\n**TrustMark - Universal Watermarking for Arbitrary Resolution Images**\n\nhttps://arxiv.org/abs/2311.18297 \n\n[Tu Bui](https://www.surrey.ac.uk/people/tu-bui) <sup>1</sup>, [Shruti Agarwal](https://research.adobe.com/person/shruti-agarwal/)  <sup>2</sup> , [John Collomosse](https://www.collomosse.com)  <sup>1,2</sup> \n\n<sup>1</sup> DECaDE Centre for the Decentralized Digital Economy, University of Surrey, UK. \\\n<sup>2</sup> Adobe Research, San Jose CA.\n\n\nThis repo contains a Python (3.8.5 or higher) (`python/`)and a browser deployable Javascript (`js/`) implementation of \nTrustMark for  encoding, decoding and removing image watermarks.  In addition, a C2PA (`c2pa/`) example is provided to \ndemonstrate signing of a watermarked image using the CAI supplied python library for C2PA / Content Credentials.\n\n\n\n### Quick start for Python\n\nWithin the python folder run `pip install .` \\\nThe TrustMark package is also available via PyPi - run `pip install trustmark` to install it indepedent of this repo.\n\nThe `python/test.py` script provides examples of watermarking images (a JPEG and a transparent PNG image are provided as examples).  To test the installation the following code snippet in Python shows typical usage:\n\n```python\nfrom trustmark import TrustMark\nfrom PIL import Image\n\n# init\ntm=TrustMark(verbose=True, model_type='Q')\n\n# encoding example\ncover = Image.open('ufo_240.jpg').convert('RGB')\ntm.encode(cover, 'mysecret').save('ufo_240_Q.png')\n\n# decoding example\ncover = Image.open('ufo_240_Q.png').convert('RGB')\nwm_secret, wm_present, wm_schema = tm.decode(cover)\nif wm_present:\n  print(f'Extracted secret: {wm_secret}')\nelse:\n  print('No watermark detected')\n\n# removal example\nstego = Image.open('ufo_240_Q.png').convert('RGB')\nim_recover = tm.remove_watermark(stego)\nim_recover.save('recovered.png')\n```\n\n\n### TrustMark Models\n\nModels are now fetched on first use, due to the number of variants and size of models they are not packaged as binary any more.\n\n### CUDA troubleshoot\n\nThe following clean install should work for getting up and running on GPU using the python implementation in this repo.\n\n```\nconda create --name trustmark python=3.10\nconda activate trustmark\nconda install pytorch cudatoolkit=12.8 -c pytorch -c conda-forge\npip install torch==2.1.2 torchvision==0.16.2 -f https://download.pytorch.org/whl/torch_stable.html\npip install .\n```\n\n## Citation\n\nIf you find this work useful we request you please cite the repo and/or TrustMark paper as follows.\n\n```\n@article{trustmark,\n  title={Trustmark: Universal Watermarking for Arbitrary Resolution Images},\n  author={Bui, Tu and Agarwal, Shruti and Collomosse, John},\n  journal = {ArXiv e-prints},\n  archivePrefix = \"arXiv\",\n  eprint = {2311.18297},\n  year = 2013,\n  month = nov\n}\n```\n\n\n",
    "bugtrack_url": null,
    "license": "Copyright 2023 Adobe All Rights Reserved.  NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms of the license agreement accompanying it.  MIT License  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "TrustMark: Universal Watermarking for Arbitrary Resolution Images",
    "version": "0.5.3",
    "project_urls": {
        "Homepage": "https://github.com/adobe/trustmark",
        "Repository": "https://github.com/adobe/trustmark.git"
    },
    "split_keywords": [
        "watermarking",
        "cai",
        "watermark",
        "content authenticity initiative",
        "provenance"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "104aae2e91da1d6d34f7d6c0677e447171d641b69ed2b3ee5c3c65eb084d4624",
                "md5": "f13915110e01c30e861fde033d45982b",
                "sha256": "fedd689cd7ab1de5ddf061d9dd07886d122ccdc2d7fc49b9eb1371972336fbb9"
            },
            "downloads": -1,
            "filename": "trustmark-0.5.3.tar.gz",
            "has_sig": false,
            "md5_digest": "f13915110e01c30e861fde033d45982b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.5",
            "size": 34419,
            "upload_time": "2024-02-19T19:54:14",
            "upload_time_iso_8601": "2024-02-19T19:54:14.401316Z",
            "url": "https://files.pythonhosted.org/packages/10/4a/ae2e91da1d6d34f7d6c0677e447171d641b69ed2b3ee5c3c65eb084d4624/trustmark-0.5.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-19 19:54:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "adobe",
    "github_project": "trustmark",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "trustmark"
}
        
Elapsed time: 0.18355s