• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Geotag Data imprinted to the image

New Here ,
Dec 07, 2012 Dec 07, 2012

Copy link to clipboard

Copied

Does anyone know of a script or action created that can take the geotag data from the exif and write it to the image like a date script in the lower corner.??

TOPICS
Actions and scripting

Views

2.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Valorous Hero ,
Dec 08, 2012 Dec 08, 2012

Copy link to clipboard

Copied

Something like this ...

if(documents.length) app.activeDocument.suspendHistory('Add Border', 'main()');

function main(){

var startRulerUnits = preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

var doc = activeDocument;

var longitude = getExifString('GPS Longitude');

var latitude = getExifString('GPS Latitude');

var fivePercent = (Math.min(doc.height,doc.width)/100) * 5;

var OffsetX = fivePercent;

var OffsetY = fivePercent/4;

var Black = new SolidColor();

Black.rgb.hexValue = '000000';

var White = new SolidColor();

White.rgb.hexValue = 'ffffff';

app.backgroundColor=Black;

doc.flatten();

doc.resizeCanvas((doc.width + (fivePercent*2)), (doc.height + (fivePercent*2)), AnchorPosition.MIDDLECENTER);

var newTextLayer = activeDocument.artLayers.add();

newTextLayer.kind = LayerKind.TEXT;

newTextLayer.textItem.kind = TextType.POINTTEXT

newTextLayer.textItem.color = White;

newTextLayer.textItem.font = "Georgia";

newTextLayer.textItem.size = 14;

newTextLayer.textItem.contents = "Longitude: " + longitude + " Latitude: " + latitude;

var LB = doc.activeLayer.bounds;

var LHeight = Math.abs(LB[3].value) - Math.abs(LB[1].value);

var percentage = ((fivePercent/LHeight)*50);

doc.activeLayer.resize(percentage,percentage,AnchorPosition.MIDDLECENTER);

LB = doc.activeLayer.bounds;

var X = (activeDocument.width - fivePercent) - LB[2].value;

var Y = (activeDocument.height - OffsetY) - LB[3];

doc.activeLayer.translate(X,Y);

doc.flatten();

preferences.rulerUnits = startRulerUnits;

}

function getExifString(searchString) {

    var exifArray = activeDocument.info.exif;

    for(var a in exifArray){

        if(exifArray[0].toString() ==  searchString){

            return exifArray[1];

            }

        }

    return  searchString + 'Not known';

};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 10, 2012 Dec 10, 2012

Copy link to clipboard

Copied

Thanks Paul, thats just about hits it right on the head! I think Im gonna tweek it so as not to have the border and put it right on the print (maybe a little smaller to, have to talk it over with my colleagues)  , but yeah, the

var longitude = getExifString('GPS Longitude');
var latitude = getExifString('GPS Latitude');

is what I was grasping for. Thanks again!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 10, 2012 Dec 10, 2012

Copy link to clipboard

Copied

Oh one thing, I just noticed its not printing the W (long) or the N (lat) after the coordinates. I could drop them in text form in there, but if Id reather it place it there right from the exif. Could you show me how to do that? I really appreciate the help, thanks again!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Dec 10, 2012 Dec 10, 2012

Copy link to clipboard

Copied

I wonder if this is better...

#target photoshop

if(documents.length) app.activeDocument.suspendHistory('Add GPS', 'main()');

function main(){

var longitude = getExifString('GPS Longitude');

var longRef = getExifString('GPS Longitude Ref');

var latitude = getExifString('GPS Latitude');

var latRef = getExifString('GPS Latitude Ref');

var TextInfo = longRef + longitude + " "  + latRef +  latitude;

//Amend to suit

var Percent = 50; /* text will be percentage of the width. */

var Black = new SolidColor();

Black.rgb.hexValue = '000000';

var newTextLayer = activeDocument.artLayers.add();

newTextLayer.kind = LayerKind.TEXT;

newTextLayer.textItem.kind = TextType.POINTTEXT;

newTextLayer.textItem.color = Black;

newTextLayer.textItem.font = "Georgia";

newTextLayer.textItem.size = 10;

newTextLayer.textItem.contents = TextInfo;

var startRulerUnits = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

var myDoc = activeDocument;

var LB = myDoc.activeLayer.bounds;

var docHeight = myDoc.height;

var docWidth = myDoc.width;

var LHeight = Math.abs(LB[3].value) - Math.abs(LB[1].value);

var LWidth = Math.abs(LB[2].value) - Math.abs(LB[0].value);   

var percentageWidth = ((docWidth/LWidth)*Percent);

myDoc.activeLayer.resize(percentageWidth,percentageWidth,AnchorPosition.MIDDLECENTER);

LB = myDoc.activeLayer.bounds;

var X = (myDoc.width-5) - LB[2].value;

var Y = (myDoc.height-5) - LB[3].value;

activeDocument.activeLayer.translate(X,Y);

app.preferences.rulerUnits = startRulerUnits;

};

function getExifString(searchString) {

    var exifArray = activeDocument.info.exif;

    for(var a in exifArray){

        if(exifArray[0].toString() ==  searchString){

            return exifArray[1];

            }

        }

    return  searchString + 'Not known';

};


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 11, 2012 Dec 11, 2012

Copy link to clipboard

Copied

First of all THANK YOU THANK YOU THANK YOU for your help......if I could buy you a present I would do it....

Thats better, I like it ...but,.....Sorry,...Id love to stroke the text black like 3 pixels. and move it off the corner about an 1/8th inch (from the bottom and the side) . Can you show me in the code where i can vary the placement of the type? Also, due to the format in which the lat and lon are recorded in the exif,  the format in which its printing is kind of wonky, with the seconds always showing 00. I attached a screen grab showing the format google earth requests, and is pretty well recognized by all. If you could just have it print exactly how its recorded in the exif , that format works well too. Also the screen grab shows the placement Im looking for.

Screen shot 2012-12-11 at 5.29.35 PM.png

Do you have a good resource for a newb coder to refference about this stuff so I dont have to keep pestering people like yourself. Frankly, I know a little code here and there, and this stuff I find horribly cryptic.

PS Thank you so much for the help with this Paul ...I really do appreciate your time, and Happy Hollidays!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Dec 11, 2012 Dec 11, 2012

Copy link to clipboard

Copied

There are no good books I'am afraid, but apart from this site www.ps-scripts.com/bb is a minefield of information, also you will find documentation in the apps scripting folder, and in the help of ExtendScript Toolkit (IDE).

I Wonder if this is better, I have added a few comments...

#target photoshop

if(documents.length) app.activeDocument.suspendHistory('Add GPS', 'main()');

function main(){

var longitude = getExifString('GPS Longitude').toString().replace(/\.00/g,'');

var longRef = getExifString('GPS Longitude Ref');

var latitude = getExifString('GPS Latitude').toString().replace(/\.00/g,'');

var latRef = getExifString('GPS Latitude Ref');

var TextInfo = "Lat: " + latitude  + " " + latRef + " Lon: " + longitude + " " + longRef;

//Amend to suit

var Percent = 50; /* text will be percentage of the width. */

var White = new SolidColor();

White.rgb.hexValue = 'ffffff';

var newTextLayer = activeDocument.artLayers.add();

newTextLayer.kind = LayerKind.TEXT;

newTextLayer.textItem.kind = TextType.POINTTEXT;

newTextLayer.textItem.color = White;

newTextLayer.textItem.font = "ArialMT";

newTextLayer.textItem.size = 10;

newTextLayer.textItem.contents = TextInfo;

var startRulerUnits = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

var myDoc = activeDocument;

var LB = myDoc.activeLayer.bounds;

var docHeight = myDoc.height;

var docWidth = myDoc.width;

var LHeight = Math.abs(LB[3].value) - Math.abs(LB[1].value);

var LWidth = Math.abs(LB[2].value) - Math.abs(LB[0].value);   

var percentageWidth = ((docWidth/LWidth)*Percent);

myDoc.activeLayer.resize(percentageWidth,percentageWidth,AnchorPosition.MIDDLECENTER);

StrokeText();

LB = myDoc.activeLayer.bounds;

//this is where the offset is

//the last char is going to be 5 pixels from the right

var X = (myDoc.width-5) - LB[2].value;

//////////////////////////////////////////

//this would make the last char 10 pixels from the right

//var X = (myDoc.width-10) - LB[2].value;

//////////////////////////////////////////

//the text will be 5 pixels up from the bottom

var Y = (myDoc.height-5) - LB[3].value;

////////////////////////////////////////////

//this would make the text 10 pixels from the bottom

//var Y = (myDoc.height-10) - LB[3].value;

//////////////////////////////////////////////

activeDocument.activeLayer.translate(X,Y);

app.preferences.rulerUnits = startRulerUnits;

};

function getExifString(searchString) {

    var exifArray = activeDocument.info.exif;

    for(var a in exifArray){

        if(exifArray[0].toString() ==  searchString){

            return exifArray[1];

            }

        }

    return  searchString + 'Not known';

};

function StrokeText(){

var desc205 = new ActionDescriptor();

var ref149 = new ActionReference();

ref149.putProperty( charIDToTypeID('Prpr'), charIDToTypeID('Lefx') );

ref149.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );

desc205.putReference( charIDToTypeID('null'), ref149 );

var desc206 = new ActionDescriptor();

desc206.putUnitDouble( charIDToTypeID('Scl '), charIDToTypeID('#Prc'), 416.666667 );

var desc207 = new ActionDescriptor();

desc207.putBoolean( charIDToTypeID('enab'), true );

desc207.putEnumerated( charIDToTypeID('Styl'), charIDToTypeID('FStl'), charIDToTypeID('InsF') );

desc207.putEnumerated( charIDToTypeID('PntT'), charIDToTypeID('FrFl'), charIDToTypeID('SClr') );

desc207.putEnumerated( charIDToTypeID('Md  '), charIDToTypeID('BlnM'), charIDToTypeID('Nrml') );

desc207.putUnitDouble( charIDToTypeID('Opct'), charIDToTypeID('#Prc'), 100.000000 );

desc207.putUnitDouble( charIDToTypeID('Sz  '), charIDToTypeID('#Pxl'), 3 );

var desc208 = new ActionDescriptor();

desc208.putDouble( charIDToTypeID('Rd  '), 0 );

desc208.putDouble( charIDToTypeID('Grn '), 0 );

desc208.putDouble( charIDToTypeID('Bl  '), 0 );

desc207.putObject( charIDToTypeID('Clr '), charIDToTypeID('RGBC'), desc208 );

desc206.putObject( charIDToTypeID('FrFX'), charIDToTypeID('FrFX'), desc207 );

desc205.putObject( charIDToTypeID('T   '), charIDToTypeID('Lefx'), desc206 );

executeAction( charIDToTypeID('setd'), desc205, DialogModes.NO );

};


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 12, 2012 Dec 12, 2012

Copy link to clipboard

Copied

That does amost all of what I needed, But the formating of the lat an lon is still off. Id like to drop the seconds off entirely. See the way it reads;

ex of an actual image used Lat: 39 19.90’ 0” N Lon: 74 30.22’ 0” W

the decimal in the minutes is a representative of the seconds, so 19.90'  is equal to 19' 54"   where  54" = .90 x 60.  So the decimal places in the minutes removes the need for the seconds place. So unless the script did the math to figure out the seconds and placed it,  we just dont need the 0" at all. Frankly from what Im looking at the minutes with a decimal ending is sufficient so just drop the seconds place all together.

Thanks for the refferences,...Ill look into them,...this code really evades me.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Dec 12, 2012 Dec 12, 2012

Copy link to clipboard

Copied

I am not sure of what I am supposed to be suppressing, but will get there in the end

#target photoshop

if(documents.length) app.activeDocument.suspendHistory('Add GPS', 'main()');

function main(){

var longitude = getExifString('GPS Longitude').toString().replace(/\.00/g,'').replace(/\.\d+"$/,'"');

var longRef = getExifString('GPS Longitude Ref');

var latitude = getExifString('GPS Latitude').toString().replace(/\.00/g,'').replace(/\.\d+"$/,'"');

var latRef = getExifString('GPS Latitude Ref');

var TextInfo = "Lat: " + latitude  + " " + latRef + " Lon: " + longitude + " " + longRef;

//Amend to suit

var Percent = 50; /* text will be percentage of the width. */

var White = new SolidColor();

White.rgb.hexValue = 'ffffff';

var newTextLayer = activeDocument.artLayers.add();

newTextLayer.kind = LayerKind.TEXT;

newTextLayer.textItem.kind = TextType.POINTTEXT;

newTextLayer.textItem.color = White;

//postscriptname  of the font is required

newTextLayer.textItem.font = "Rockwell-Bold";

newTextLayer.textItem.size = 10;

newTextLayer.textItem.contents = TextInfo;

var startRulerUnits = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

var myDoc = activeDocument;

var LB = myDoc.activeLayer.bounds;

var docHeight = myDoc.height;

var docWidth = myDoc.width;

var LHeight = Math.abs(LB[3].value) - Math.abs(LB[1].value);

var LWidth = Math.abs(LB[2].value) - Math.abs(LB[0].value);   

var percentageWidth = ((docWidth/LWidth)*Percent);

myDoc.activeLayer.resize(percentageWidth,percentageWidth,AnchorPosition.MIDDLECENTER);

StrokeText();

LB = myDoc.activeLayer.bounds;

//another way to do the offset

//the document resolution = one inch so  1/8th =

var offset = myDoc.resolution/8;

var X = (myDoc.width-offset) - LB[2].value;

var Y = (myDoc.height-offset) - LB[3].value;

activeDocument.activeLayer.translate(X,Y);

app.preferences.rulerUnits = startRulerUnits;

};

function getExifString(searchString) {

    var exifArray = activeDocument.info.exif;

    for(var a in exifArray){

        if(exifArray[0].toString() ==  searchString){

            return exifArray[1];

            }

        }

    return  searchString + 'Not known';

};

function StrokeText(){

var desc205 = new ActionDescriptor();

var ref149 = new ActionReference();

ref149.putProperty( charIDToTypeID('Prpr'), charIDToTypeID('Lefx') );

ref149.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );

desc205.putReference( charIDToTypeID('null'), ref149 );

var desc206 = new ActionDescriptor();

desc206.putUnitDouble( charIDToTypeID('Scl '), charIDToTypeID('#Prc'), 416.666667 );

var desc207 = new ActionDescriptor();

desc207.putBoolean( charIDToTypeID('enab'), true );

desc207.putEnumerated( charIDToTypeID('Styl'), charIDToTypeID('FStl'), charIDToTypeID('InsF') );

desc207.putEnumerated( charIDToTypeID('PntT'), charIDToTypeID('FrFl'), charIDToTypeID('SClr') );

desc207.putEnumerated( charIDToTypeID('Md  '), charIDToTypeID('BlnM'), charIDToTypeID('Nrml') );

desc207.putUnitDouble( charIDToTypeID('Opct'), charIDToTypeID('#Prc'), 100.000000 );

desc207.putUnitDouble( charIDToTypeID('Sz  '), charIDToTypeID('#Pxl'), 3 );

var desc208 = new ActionDescriptor();

desc208.putDouble( charIDToTypeID('Rd  '), 0 );

desc208.putDouble( charIDToTypeID('Grn '), 0 );

desc208.putDouble( charIDToTypeID('Bl  '), 0 );

desc207.putObject( charIDToTypeID('Clr '), charIDToTypeID('RGBC'), desc208 );

desc206.putObject( charIDToTypeID('FrFX'), charIDToTypeID('FrFX'), desc207 );

desc205.putObject( charIDToTypeID('T   '), charIDToTypeID('Lefx'), desc206 );

executeAction( charIDToTypeID('setd'), desc205, DialogModes.NO );

};


If you wanted to see all the GPS fields you could run this bit of code to see the field names and thier values...

if(documents.length){

var GPS=[];

var exifArray = activeDocument.info.exif;

for(var a in exifArray){

if(exifArray.toString().match(/^gps/i)) GPS.push(exifArray[0] + " = " + exifArray[1]);

}

alert(GPS.join('\r'));

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 12, 2012 Dec 12, 2012

Copy link to clipboard

Copied

all I want to do is drop off the last  0.00" .....if possible.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Dec 12, 2012 Dec 12, 2012

Copy link to clipboard

Copied

I just realised that I was removing .00 globally, this may work....

#target photoshop

if(documents.length) app.activeDocument.suspendHistory('Add GPS', 'main()');

function main(){

var longitude = getExifString('GPS Longitude').toString().replace(/0\.00"$/,'').replace(/\.00/g,'');

var longRef = getExifString('GPS Longitude Ref');

var latitude = getExifString('GPS Latitude').toString().replace(/0\.00"$/,'').replace(/\.00/g,'');

var latRef = getExifString('GPS Latitude Ref');

var TextInfo = "Lat: " + latitude  + " " + latRef + " Lon: " + longitude + " " + longRef;

//Amend to suit

var Percent = 50; /* text will be percentage of the width. */

var White = new SolidColor();

White.rgb.hexValue = 'ffffff';

var newTextLayer = activeDocument.artLayers.add();

newTextLayer.kind = LayerKind.TEXT;

newTextLayer.textItem.kind = TextType.POINTTEXT;

newTextLayer.textItem.color = White;

//postscriptname  of the font is required

newTextLayer.textItem.font = "Rockwell-Bold";

newTextLayer.textItem.size = 10;

newTextLayer.textItem.contents = TextInfo;

var startRulerUnits = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

var myDoc = activeDocument;

var LB = myDoc.activeLayer.bounds;

var docHeight = myDoc.height;

var docWidth = myDoc.width;

var LHeight = Math.abs(LB[3].value) - Math.abs(LB[1].value);

var LWidth = Math.abs(LB[2].value) - Math.abs(LB[0].value);   

var percentageWidth = ((docWidth/LWidth)*Percent);

myDoc.activeLayer.resize(percentageWidth,percentageWidth,AnchorPosition.MIDDLECENTER);

StrokeText();

LB = myDoc.activeLayer.bounds;

//another way to do the offset

//the document resolution = one inch so  1/8th =

var offset = myDoc.resolution/8;

var X = (myDoc.width-offset) - LB[2].value;

var Y = (myDoc.height-offset) - LB[3].value;

activeDocument.activeLayer.translate(X,Y);

app.preferences.rulerUnits = startRulerUnits;

};

function getExifString(searchString) {

    var exifArray = activeDocument.info.exif;

    for(var a in exifArray){

        if(exifArray[0].toString() ==  searchString){

            return exifArray[1];

            }

        }

    return  searchString + 'Not known';

};

function StrokeText(){

var desc205 = new ActionDescriptor();

var ref149 = new ActionReference();

ref149.putProperty( charIDToTypeID('Prpr'), charIDToTypeID('Lefx') );

ref149.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );

desc205.putReference( charIDToTypeID('null'), ref149 );

var desc206 = new ActionDescriptor();

desc206.putUnitDouble( charIDToTypeID('Scl '), charIDToTypeID('#Prc'), 416.666667 );

var desc207 = new ActionDescriptor();

desc207.putBoolean( charIDToTypeID('enab'), true );

desc207.putEnumerated( charIDToTypeID('Styl'), charIDToTypeID('FStl'), charIDToTypeID('InsF') );

desc207.putEnumerated( charIDToTypeID('PntT'), charIDToTypeID('FrFl'), charIDToTypeID('SClr') );

desc207.putEnumerated( charIDToTypeID('Md  '), charIDToTypeID('BlnM'), charIDToTypeID('Nrml') );

desc207.putUnitDouble( charIDToTypeID('Opct'), charIDToTypeID('#Prc'), 100.000000 );

desc207.putUnitDouble( charIDToTypeID('Sz  '), charIDToTypeID('#Pxl'), 3 );

var desc208 = new ActionDescriptor();

desc208.putDouble( charIDToTypeID('Rd  '), 0 );

desc208.putDouble( charIDToTypeID('Grn '), 0 );

desc208.putDouble( charIDToTypeID('Bl  '), 0 );

desc207.putObject( charIDToTypeID('Clr '), charIDToTypeID('RGBC'), desc208 );

desc206.putObject( charIDToTypeID('FrFX'), charIDToTypeID('FrFX'), desc207 );

desc205.putObject( charIDToTypeID('T   '), charIDToTypeID('Lefx'), desc206 );

executeAction( charIDToTypeID('setd'), desc205, DialogModes.NO );

};


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 12, 2012 Dec 12, 2012

Copy link to clipboard

Copied

LATEST

Perfect!! Thanks again Paul you've been a huge help!! If you can think of anymore resources for learning this code Im all ears.

Date: Wed, 12 Dec 2012 09:39:53 -0700

From: forums_noreply@adobe.com

To: clifford_compton@hotmail.com

Subject: Geotag Data imprinted to the image

Re: Geotag Data imprinted to the image

created by Paul Riggott in Photoshop Scripting - View the full discussion

I just realised that I was removing .00 globally, this may work.... #target photoshop

if(documents.length) app.activeDocument.suspendHistory('Add GPS', 'main()');

function main(){

var longitude = getExifString('GPS Longitude').toString().replace(/0\.00"$/,'').replace(/\.00/g,'');

var longRef = getExifString('GPS Longitude Ref');

var latitude = getExifString('GPS Latitude').toString().replace(/0\.00"$/,'').replace(/\.00/g,'');

var latRef = getExifString('GPS Latitude Ref');

var TextInfo = "Lat: " + latitude + " " + latRef + " Lon: " + longitude + " " + longRef;

//Amend to suit

var Percent = 50; /* text will be percentage of the width. */

var White = new SolidColor();

White.rgb.hexValue = 'ffffff';

var newTextLayer = activeDocument.artLayers.add();

newTextLayer.kind = LayerKind.TEXT;

newTextLayer.textItem.kind = TextType.POINTTEXT;

newTextLayer.textItem.color = White;

//postscriptname of the font is required

newTextLayer.textItem.font = "Rockwell-Bold";

newTextLayer.textItem.size = 10;

newTextLayer.textItem.contents = TextInfo;

var startRulerUnits = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

var myDoc = activeDocument;

var LB = myDoc.activeLayer.bounds;

var docHeight = myDoc.height;

var docWidth = myDoc.width;

var LHeight = Math.abs(LB[3].value) - Math.abs(LB[1].value);

var LWidth = Math.abs(LB[2].value) - Math.abs(LB[0].value);

var percentageWidth = ((docWidth/LWidth)*Percent);

myDoc.activeLayer.resize(percentageWidth,percentageWidth,AnchorPosition.MIDDLECENTER);

StrokeText();

LB = myDoc.activeLayer.bounds;

//another way to do the offset

//the document resolution = one inch so 1/8th =

var offset = myDoc.resolution/8;

var X = (myDoc.width-offset) - LB[2].value;

var Y = (myDoc.height-offset) - LB[3].value;

activeDocument.activeLayer.translate(X,Y);

app.preferences.rulerUnits = startRulerUnits;

};

function getExifString(searchString) {

var exifArray = activeDocument.info.exif;

for(var a in exifArray){

if(exifArray[0].toString() == searchString){

return exifArray[1];

}

}

return searchString + 'Not known';

};

function StrokeText(){

var desc205 = new ActionDescriptor();

var ref149 = new ActionReference();

ref149.putProperty( charIDToTypeID('Prpr'), charIDToTypeID('Lefx') );

ref149.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );

desc205.putReference( charIDToTypeID('null'), ref149 );

var desc206 = new ActionDescriptor();

desc206.putUnitDouble( charIDToTypeID('Scl '), charIDToTypeID('#Prc'), 416.666667 );

var desc207 = new ActionDescriptor();

desc207.putBoolean( charIDToTypeID('enab'), true );

desc207.putEnumerated( charIDToTypeID('Styl'), charIDToTypeID('FStl'), charIDToTypeID('InsF') );

desc207.putEnumerated( charIDToTypeID('PntT'), charIDToTypeID('FrFl'), charIDToTypeID('SClr') );

desc207.putEnumerated( charIDToTypeID('Md '), charIDToTypeID('BlnM'), charIDToTypeID('Nrml') );

desc207.putUnitDouble( charIDToTypeID('Opct'), charIDToTypeID('#Prc'), 100.000000 );

desc207.putUnitDouble( charIDToTypeID('Sz '), charIDToTypeID('#Pxl'), 3 );

var desc208 = new ActionDescriptor();

desc208.putDouble( charIDToTypeID('Rd '), 0 );

desc208.putDouble( charIDToTypeID('Grn '), 0 );

desc208.putDouble( charIDToTypeID('Bl '), 0 );

desc207.putObject( charIDToTypeID('Clr '), charIDToTypeID('RGBC'), desc208 );

desc206.putObject( charIDToTypeID('FrFX'), charIDToTypeID('FrFX'), desc207 );

desc205.putObject( charIDToTypeID('T '), charIDToTypeID('Lefx'), desc206 );

executeAction( charIDToTypeID('setd'), desc205, DialogModes.NO );

};

Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4915726#4915726

Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:

To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.

Start a new discussion in Photoshop Scripting by email or at Adobe Community

For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines