Watermark on Various Dimension

Discussion of Automation, Image Workflow and Raw Image Workflow

Moderators: Tom, Kukurykus

bingildak
Posts: 2
Joined: Wed Feb 01, 2017 1:22 pm

Watermark on Various Dimension

Post by bingildak »

Hello,

First of all - thanks for the awesome community. My first post :)

I am trying to put my watermark on various images, normally the whole process is very simple and easy to execute, automate.

This time, differently, I need to add my watermark on images that are various in dimension. Some are 600*600, some are 900*900 and some 1500*800 etc etc.

I need to resize my watermark according to the size of the image I am applying it to. In other words, watermark needs to keep it's proportion relative to image.

For example, if I am applying watermark on a image with 1000*1000 dimension, watermark needs to be 100*100. If the next image is smaller, lets say 600*600 then watermark needs to shrink down to 60*60 to keep same proportion as previous image.

I did some research and found out it can be done with scripts but I am unable to code it myself and couldn't find any available to use either.

There is an awesome add-in for it Watermark CC but the function I need requires pro version which costs 30 dolars. Since it is a very situational exception, I can't afford to spend that money for one time use.

Any kind of help to set me on the right course is appreciated.
User avatar
txuku
Posts: 136
Joined: Thu Jan 01, 1970 12:00 am

Re: Watermark on Various Dimension

Post by txuku »

Bonjour

In doubt about your script ....

I give you mine :

Code: Select all

//NOM_Proportion.jsx

var docRef = activeDocument;
var docResolution = app.activeDocument.resolution;
app.activeDocument.resizeImage( undefined, undefined, 72, ResampleMethod.NONE);
var monNom = "txuku"; //mettre son nom

var Rouge = 230; //valeurs de 0 a 255
var Vert = 81;
var Bleu = 35;
valOpacite = 100; //de 0 a 100%


NomPolice = "CourierNewPS-BoldMT"; // "ArialMT" "LucidaCalligraphy-Italic" //"ParkAvenue BT" il faut trouver les noms postcripts des fontes.

var posHoriz = docRef.width*(75/100); //je donne un pourcentage de la taille du document
var posVertic = docRef.height*(98/100); //pour la position du texte

//Opacite = 85 ; // reglage de la transparence du calque texte ( de 0 a 100 )

var TailleFonte = "";

//Je rends TailleFonte proportionnel a la taille de l image :

TailleFonteW = docRef.width*(2/100); // modifier ( = 70 pt pour 3888 px - 20 pt pour 1000 px)

TailleFonteH = docRef.height*(2/100);

if ( docRef.width>docRef.height ) // Portrait ou paysage
{
TailleFonte = TailleFonteW;
}
else
{
TailleFonte = TailleFonteH;
}

var textColor = new SolidColor;
textColor.rgb.red = Rouge;
textColor.rgb.green = Vert;
textColor.rgb.blue = Bleu;
textColor.opacity = valOpacite;

//alert( TailleFonte )

//fontPostScriptName = "ArialMT"; //"LucidaCalligraphy-Italic"
//"ParkAvenueBT-Regular" - Normal Gras ...etc


//app.displayDialogs = DialogModes.NO;
//app.preferences.typeUnits = TypeUnits.POINTS;


var newTextLayer = docRef.artLayers.add(); // le calque de Texte
newTextLayer.kind = LayerKind.TEXT;
newTextLayer.textItem.contents = monNom;
newTextLayer.textItem.position = Array(posHoriz, posVertic);
//newTextLayer.textItem.postScriptName = fontPostScriptName;
newTextLayer.textItem.font = NomPolice
newTextLayer.textItem.size = TailleFonte;
newTextLayer.textItem.color = textColor;
newTextLayer.opacity = valOpacite;;
docRef.flatten(); //aplatir

app.activeDocument.resizeImage( undefined, undefined, docResolution, ResampleMethod.NONE);
bingildak
Posts: 2
Joined: Wed Feb 01, 2017 1:22 pm

Re: Watermark on Various Dimension

Post by bingildak »

thanks alot mate, most appreciated
User avatar
txuku
Posts: 136
Joined: Thu Jan 01, 1970 12:00 am

Re: Watermark on Various Dimension

Post by txuku »

:)
ngochian0212
Posts: 1
Joined: Mon Jul 01, 2019 4:16 am

Re: Watermark on Various Dimension

Post by ngochian0212 »

Hello all,

Can anybody help me do the same thing but the watermark here is an image?

Thank you so much!
User avatar
txuku
Posts: 136
Joined: Thu Jan 01, 1970 12:00 am

Re: Watermark on Various Dimension

Post by txuku »

Bonjour

You should open your own post !!!

In the Help Me forum :)
tanvishah
Posts: 1
Joined: Fri Mar 06, 2020 9:27 am

Re: Watermark on Various Dimension

Post by tanvishah »

Great Post :)