How to check images for copyright using Transloadit
Being able to check images for copyright has become increasingly important as online DMCA regulations have become tighter. Manually checking images for copyright is a labor-intensive solution that simply isn't possible for large sites that host user generated content. That's why we're going to take a look at how you can automatically check for copyright information in images using the Transloadit API.
As a bonus, we'll also take a look at how you can burn metadata attributes into images you publish onto your site, to prevent misuse of your copyrighted content.
Checking image metadata
One of the first steps in managing image copyrights is to check the existing metadata. Transloadit makes this process simple, efficient, and cost-effective. Here's an example that rejects images that contain copyright metadata:
{
"steps": {
":original": {
"robot": "/upload/handle"
},
"filter": {
"use": ":original",
"robot": "/file/filter",
"result": true,
"accepts": [["${file.meta.copyright}", "==", ""]],
"error_on_decline": false
},
"exported": {
"robot": "/s3/store",
"use": [":original", "filter"],
"credentials": "YOUR_AWS_CREDENTIALS",
"url_prefix": "https://demos.transloadit.com/"
}
}
}
While a simple filter Step is a good first line of defense, it won't be effective in all cases, especially since knowledgeable users can easily remove metadata from an image before uploading it. That's why we recommend employing the Swiss cheese model for your copyright defense, to maximize your chances of preventing unauthorized copyrighted content from being uploaded.
Reverse image search
For the second layer in our stack of Swiss cheese, we're going to employ reverse image searching. While Transloadit doesn't directly provide reverse image search functionality, you can integrate it yourself by using the Google Images API to perform reverse image searches, and flagging images that have matches with copyrighted content.
Here's a brief guide to get you started with using the Google Images API:
- Create a new programmable search engine, with image search enabled. Make sure to set this to search the entire web.
- Copy your API key and follow the steps outlined
here to invoke your custom search
engine. Any API requests you send here also need to include
?searchType=image
. - Google will then return information about the search performed. What we're interested in is the
image rights
attribute. You can set this to the copyright license you want to filter by, for example
cc_attribute
to only include images with required copyright attribution. If there's a match here, it indicates our image needs to be rejected, as it is under copyright protection.
DMCA tooling
However, this solution is not foolproof, as reverse image search is not entirely reliable. Therefore, we recommend implementing robust manual tooling to enable administrators and content moderators to easily remove copyrighted content in response to any DMCA requests you may receive.
How do I watermark my images?
If you're on the other side of the copyright struggle, and you want some offensive strategies to enforce your copyright, we also have you covered! Our hardy /image/resize Robot contains all the tools you need to easily burn a watermark onto any image. Here's an example Template that adds the Transloadit logo onto any image that passes through it:
{
"steps": {
":original": {
"robot": "/upload/handle"
},
"watermarked": {
"use": ":original",
"robot": "/image/resize",
"result": true,
"format": "jpg",
"watermark_url": "https://demos.transloadit.com/inputs/transloadit-padded.png",
"watermark_size": "25%",
"watermark_position": "bottom-right",
"imagemagick_stack": "v3.0.0"
},
"exported": {
"use": ["watermarked", ":original"],
"robot": "/s3/store",
"credentials": "YOUR_AWS_CREDENTIALS",
"url_prefix": "https://demos.transloadit.com/"
}
}
}
Adding copyright metadata to an image
While this watermark is great for alerting users to copyright for an image, we also want to help automated systems, like the one we outlined earlier, find and flag our copyrighted content more easily. One step we can take to do this is by adding copyright information to the metadata of our content. For example, the Assembly Instructions below will embed copyright information in the image's metadata, and also burn that into the bottom right corner of the image.
{
"steps": {
":original": {
"robot": "/upload/handle"
},
"attributed": {
"use": ":original",
"robot": "/meta/write",
"result": true,
"data_to_write": {
"copyright": "Copyright 2018 Transloadit"
},
"ffmpeg_stack": "v6.0.0"
},
"watermarked": {
"use": ":original",
"robot": "/image/resize",
"result": true,
"width": 1280,
"height": 720,
"text": [
{
"text": "${file.meta.copyright}",
"size": 32,
"font": "Ubuntu",
"color": "#FFFFFF",
"valign": "bottom",
"align": "right",
"x_offset": 16,
"y_offset": -10
}
],
"resize_strategy": "fillcrop",
"imagemagick_stack": "v3.0.0"
},
"exported": {
"use": ["attributed", "watermarked", ":original"],
"robot": "/s3/store",
"credentials": "YOUR_AWS_CREDENTIALS",
"url_prefix": "https://demos.transloadit.com/"
}
}
}
Conclusion
And there you have it, folks! We've covered a bunch of ways to handle image copyrights using Transloadit, from checking metadata to adding watermarks. Hopefully you're now better equipped to tackle the problem of copyright attribution. Remember, no single method is perfect, so mix and match to find what works best for you. Whether you're protecting your site or your own amazing pictures, these tools should make your life a whole lot easier.