title: How can I apply a watermark in images using JavaScript?
body: <p>I'm using angularJS and need to apply a watermark programatelly in images by calling an JS function. What I have is:</p>
  
  <pre><code>&lt;figure&gt;&lt;img class="watermark" ng-src="{{applyWatermark(img.url)}}"&gt;&lt;/figure&gt;  
  </code></pre>
  
  <p>So, I need to call that function applyWatermark (not implemented yet) and return a img with the watermark, but I'm not sure how can I build this function. Should it return the image? Can someone provide me some example how can I do this?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I did this, but it's not working:</p>
  
  <pre><code> $(function applyWatermark(image) {                                                                                                                                                                                                      
       watermark([image, 'watermark.png'])                                                                                                                       
         .image(watermark.image.lowerRight())                                                                                                                                                                                              
         .then(function (img) {                                                                                                                                                                                                            
             return img                                                                                                                                                                                                                    
         });                                                                                                                                                                                                                               
   })  
  </code></pre>
  
  <p>Any idea?</p>