Apply a text watermark to your images

The /image/resize Robot offers numerous parameters to add custom text onto an image. Some aren't even used in the demo below. Please upload an image below to have a text watermark applied to it.

Warning It seems your browser does not send the referer, which we need to stop people from (ab)using our demos in other websites. If you want to use the demos, please allow your browser to send its referer to us. Adding us to the whitelist of blockers usually helps.

This demo uses:

  • Our /image/resize Robot, which resizes, crops, changes colorization, rotation, and applies text and watermarks to images

This demo uses :original, which indicates a user upload that was received by Transloadit. If you'd initiate the encoding from your servers, you will likely want to add one of our import Robots to acquire the input files instead.



By using our jQuery SDK, you can bring the power of Transloadit directly to your HTML forms. It will even display a stylish upload progress bar.

Enjoy ample customization options for design and behavior and make use of the many event callbacks to tailor its behavior to your needs.

We have a great new JavaScript uploader in the works called Uppy and you are welcome to give that a shot, but for now, the following example uses our jQuery SDK and it is still the recommended way to integrate Transloadit into web browsers.

<body>
  <form action="/uploads" enctype="multipart/form-data" method="POST">
    <input type="file" name="my_file" multiple="multiple" />
  </form>

  <script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
  <script src="//assets.transloadit.com/js/jquery.transloadit2-v3-latest.js"></script>
  <script type="text/javascript">
  $(function() {
    $('form').transloadit({
      wait: true,
      triggerUploadOnFileSelection: true,
      params: {
        auth: {
          // Secure via: https://transloadit.com/docs/api-docs/#authentication
          key: 'YOUR_TRANSLOADIT_KEY',
        },
        // It's often better to use a `template_id` than to
        // inline encoding instructions here:
        steps: {
          watermark: {
            use: ':original',
            robot: '/image/resize',
            result: true,
            text: [{'text':'Example text','size':25,'font':'VerdanaBI','color':'#aa0000','valign':'center','align':'center','x_offset':-30,'y_offset':50}]
          }
        }
      }
    });
  });
  </script>
</body>

Uppy is our take on perfecting file uploading in the browser. It's rather new and not stable yet, but if you'd like to play around with it, you can already!

<link href="https://unpkg.com/uppy/dist/uppy.min.css" rel="stylesheet">
<script src="https://unpkg.com/uppy/dist/uppy.min.js"></script>
<button id="uppy-open-modal">Select Files</button>
<script>
  const uppy = Uppy.Core({ debug: true, autoProceed: false })
    .use(Uppy.Tus10, { resume: false })
    .use(Uppy.Transloadit, {
      params: {
        auth: {
          key: 'YOUR_TRANSLOADIT_KEY',
        },
        steps: {
          watermark: {
            use: ':original',
            robot: '/image/resize',
            result: true,
            text: [{'text':'Example text','size':25,'font':'VerdanaBI','color':'#aa0000','valign':'center','align':'center','x_offset':-30,'y_offset':50}]
          }
        }
      },
      waitForEncoding: true,
    })
    .use(Uppy.Dashboard, {
      trigger: '#uppy-open-modal',
      target: 'body'
    })
    .use(Uppy.Webcam, { target: Dashboard })
    .on('transloadit:result', (stepName, result) => {
      // use transloadit encoding result here.
      console.log('Result here ====>', stepName, result)
    })
    .run()
</script>

We have a fully featured software development kit for Node.js, so you can easily integrate it into your node apps.

// npm install transloadit --save
const TransloaditClient = require('transloadit')

const transloadit = new TransloaditClient({
  authKey: 'YOUR_TRANSLOADIT_KEY',
  authSecret: 'YOUR_TRANSLOADIT_SECRET'
})

transloadit.addFile('myinput', './lolcat.jpg')
const options = {
  params: {
    steps: {
      watermark: {
        use: ':original',
        robot: '/image/resize',
        result: true,
        text: [{'text':'Example text','size':25,'font':'VerdanaBI','color':'#aa0000','valign':'center','align':'center','x_offset':-30,'y_offset':50}]
      }
    }
  }
}

transloadit.createAssembly(options, (err, result) => {
  if (err) {
    throw err
  }

  console.log({result})
})

Our PHP SDK allows you to automate the uploading of files through the Transloadit REST API using PHP.

It can be installed via composer.

// Install "transloadit/php-sdk"
// via Composer (https://getcomposer.org)
use transloadit\Transloadit;
$transloadit = new Transloadit(array(
  "key" => "YOUR_TRANSLOADIT_KEY",
  "secret" => "YOUR_TRANSLOADIT_SECRET",
));

$files = array();
array_push($files, "./lolcat.jpg");
$response = $transloadit->createAssembly(array(
  "files" => $files,
  "params" => array(
    "steps" => json_decode({
      "watermark": {
        "use": ":original",
        "robot": "/image/resize",
        "result": true,
        "text": [
          {
            "text": "Example text",
            "size": 25,
            "font": "VerdanaBI",
            "color": "#aa0000",
            "valign": "center",
            "align": "center",
            "x_offset": -30,
            "y_offset": 50
          }
        ]
      }
    }, true),
  ),
));

Our Ruby Gem allows you to automate the uploading of files through the Transloadit REST API.

If you run Ruby on Rails and are instead looking to integrate with the browser to handle file uploads, then we also have a Ruby on Rails SDK ready for you to use.

# gem install transloadit
transloadit = Transloadit.new(
  :key => "YOUR_TRANSLOADIT_KEY",
  :secret => "YOUR_TRANSLOADIT_SECRET"
)

watermark = transloadit.step "watermark", "/image/resize",
  :use => ":original",
  :result => true,
  :text => [{"text":"Example text","size":25,"font":"VerdanaBI","color":"#aa0000","valign":"center","align":"center","x_offset":-30,"y_offset":50}]
)

assembly = transloadit.assembly(
  :steps => [ watermark ]
)

files = []
files.push('./lolcat.jpg')
response = assembly.create! *files

until response.finished?
  sleep 1; response.reload!
end

if !response.error?
  # handle success
end
from transloadit import client

tl = client.Transloadit('YOUR_TRANSLOADIT_KEY', 'YOUR_TRANSLOADIT_SECRET')
assembly = tl.new_assembly()

assembly.add_file(open('./lolcat.jpg', 'rb'))
assembly.add_step('watermark', '/image/resize', {'use':':original','robot':'/image/resize','result':true,'text':[{'text':'Example text','size':25,'font':'VerdanaBI','color':'#aa0000','valign':'center','align':'center','x_offset':-30,'y_offset':50}]})

assembly_response = assembly.create(retries=5, wait=True)

print assembly_response.data.get('assembly_id')

# or
print assembly_response.data['assembly_id']

We have a powerful Go client that makes using Transloadit easy.

// go get gopkg.in/transloadit/go-sdk.v1
options := transloadit.DefaultConfig
options.AuthKey = "YOUR_TRANSLOADIT_KEY"
options.AuthSecret = "YOUR_TRANSLOADIT_SECRET"
client := transloadit.NewClient(options)

// Initialize new assembly
assembly := transloadit.NewAssembly()

// Add files to upload
assembly.AddFile("myinput", "./lolcat.jpg")
// Add instructions, e.g. resize image, or encode video
assembly.AddStep("watermark", map[string]interface{}{
  "use": ":original",
  "robot": "/image/resize",
  "result": true,
  "text": [{"text":"Example text","size":25,"font":"VerdanaBI","color":"#aa0000","valign":"center","align":"center","x_offset":-30,"y_offset":50}]
})


// Start the upload
info, err := client.StartAssembly(context.Background(), assembly)
if err != nil {
  panic(err)
}

// All files have now been uploaded and the assembly has started but no
// results are available yet since the conversion has not finished.
// WaitForAssembly provides functionality for polling until the assembly
// has ended.
info, err = client.WaitForAssembly(context.Background(), info)
if err != nil {
  panic(err)
}

fmt.Printf("You can view the result at: %s\n", info.Results["resize"][0].SSLURL)
// compile 'com.transloadit.sdk:transloadit:0.0.3'
import com.transloadit.sdk.Assembly;
import com.transloadit.sdk.Transloadit;
import com.transloadit.sdk.exceptions.LocalOperationException;
import com.transloadit.sdk.exceptions.RequestException;
import com.transloadit.sdk.response.AssemblyResponse;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

public class Main {
    public static void main(String[] args) {
        Transloadit transloadit = new Transloadit("YOUR_TRANSLOADIT_KEY", "YOUR_TRANSLOADIT_SECRET");
        Assembly assembly = transloadit.newAssembly();
        
        Map<String, Object> watermarkStepOptions = new HashMap<>();
        watermarkStepOptions.put("use", ":original");
        watermarkStepOptions.put("result", true);
        watermarkStepOptions.put("text", new String[]{ "{"text"=>"Example text", "size"=>25, "font"=>"VerdanaBI", "color"=>"#aa0000", "valign"=>"center", "align"=>"center", "x_offset"=>-30, "y_offset"=>50}" });
        assembly.addStep("watermark", "/image/resize", watermarkStepOptions);
        
        assembly.addFile(new File("./lolcat.jpg"));
        try {
            AssemblyResponse response = assembly.save();

            // wait for assembly to finish executing.
            while (!response.isFinished()) {
                response = transloadit.getAssemblyByUrl(response.getSslUrl());
            }

            System.out.println(response.getId());
            System.out.println(response.getUrl());
            System.out.println(response.json());
        } catch (RequestException | LocalOperationException e) {
            // handle exception here
        }
    }
}

Don't feel like coding? Use our command line tool to watch an ./input/ directory for incoming files and automatically convert them through instructions that you saved locally in: ./steps.json.

The results will be saved in the ./output/ directory.

You can optionally automatically remove successfully processed input files.

npm install transloadify -g

echo '{
  "watermark": {
    "use": ":original",
    "robot": "/image/resize",
    "result": true,
    "text": [
      {
        "text": "Example text",
        "size": 25,
        "font": "VerdanaBI",
        "color": "#aa0000",
        "valign": "center",
        "align": "center",
        "x_offset": -30,
        "y_offset": 50
      }
    ]
  }
}' > ./steps.json

export TRANSLOADIT_KEY="YOUR_TRANSLOADIT_KEY"
export TRANSLOADIT_SECRET="YOUR_TRANSLOADIT_SECRET"

transloadify \
  --input ./lolcat.jpg \
  --output ./resized-lolcat.jpg \
  --steps ./steps.json

Instead of sending Assembly Instructions directly to Transloadit, you can also save them in a secured way as a Template. You can then refer to the template_id in your requests, making sure that secrets and Instructions no longer have to be transmitted, which is a security risk in many cases.

Here is the 'raw' Template, in case you would like to save these Instructions safely in your account, or use these Instructions to talk directly to our REST API without using any SDK.

{
  "steps": {
    "watermark": {
      "use": ":original",
      "robot": "/image/resize",
      "result": true,
      "text": [
        {
          "text": "Example text",
          "size": 25,
          "font": "VerdanaBI",
          "color": "#aa0000",
          "valign": "center",
          "align": "center",
          "x_offset": -30,
          "y_offset": 50
        }
      ]
    }
  }
}

So many ways to integrate

Transloadit's versatility not only shines through in our diverse encoding features, but also in the ways that you can integrate with those. Would you like to handle your own file uploads? Or do you have a big library of files ready to be encoded? You leverage Transloadit's highly scalable encoding platform by letting us import from your source or post files directly from your server using a backend language. We have kits available for most platforms.

If there's no kit available for your platform, you can integrate with our REST API.

Perhaps you want Transloadit to also handle uploads? In this case take a look at our HTML integrations.

Notifying your server

Transloadit will then accept the upload on behalf of your site, process all the files according to your Assembly Instructions and export to your storage platform of choice. Your visitor will now in reality be uploading links to the encoding results (example) to your website's /uploads URL.

This takes the pressure off your platform, and ensures the user will have a smooth experience.

Typically, it is advisable to save a record of the result in your database, so you will need to inspect the transloadit POST payload that was sent to your /uploads, or Notification URL. In PHP, that would look like this:

print_r(json_decode($_POST['transloadit'], true));

Try it out

Maximum size for all demos is 100MB.

Transloadit is a service for companies with developers. Visitors are welcome to do one-off media conversions but unfortunately we cannot provide support for that, sorry!


Try it in your account

Try out this demo in your own account by pasting it into one of your Templates.

Get started for free

Sign up with GitHub or

Need help? Talk to a human