Hi,
A few years ago, I remember I came across a plug-in which could "convert" an image's IPTC info into pixels and write it underneath the image. Can't remember the plug-in's name though.... I tried google, but no luck there.
So the question now is: Is it possible to do this with a script?
Ideally, I would like to:
1) open image
2) extend the image's canvas by 50px further down
3) with bespoke "script": read "IPTC Caption" + "IPTC City" + "IPTC Country" and write it into a text-layer into that 50px canvas-extension. So it reads something like "Golden Gate Bridge, San Francisco, USA"
4) merge layers
5) save file
I know how to write Photoshop-Actions, so these 5 steps are easy.
However, with step 3 I would need help – as my Javascript knowledge is very limited. Can someone here maybe help me with this?
Thank you very much!
Bjorn
Putting IPTC data into pixels, underneath image
Putting IPTC data into pixels, underneath image
This should get you started...
Code: Select allvar doc= activeDocument;
var originalRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var Desc = doc.info.caption;
var City = doc.info.city;
var Country = doc.info.country;
var addTextArea = 50;
var white = new SolidColor();
white.rgb.hexValue = 'ffffff';
app.backgroundColor = white;
var Width = doc.width;
var Height = doc.height + addTextArea;
doc.resizeCanvas(Width , Height , AnchorPosition.TOPCENTER);
var fontSize = 20;
var fontName = "Helvetica";
var textColor = new SolidColor;
textColor.rgb.hexValue = '000000';
var newTextLayer = doc.artLayers.add();
newTextLayer.kind = LayerKind.TEXT;
newTextLayer.textItem.kind = TextType.POINTTEXT
newTextLayer.textItem.color = textColor;
newTextLayer.textItem.font = fontName;
newTextLayer.textItem.size = fontSize;
newTextLayer.textItem.contents =Desc + ", " + City + " , " + Country;
newTextLayer.textItem.position = Array(10, Height - (addTextArea/2));
preferences.rulerUnits = originalRulerUnits;
Code: Select allvar doc= activeDocument;
var originalRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var Desc = doc.info.caption;
var City = doc.info.city;
var Country = doc.info.country;
var addTextArea = 50;
var white = new SolidColor();
white.rgb.hexValue = 'ffffff';
app.backgroundColor = white;
var Width = doc.width;
var Height = doc.height + addTextArea;
doc.resizeCanvas(Width , Height , AnchorPosition.TOPCENTER);
var fontSize = 20;
var fontName = "Helvetica";
var textColor = new SolidColor;
textColor.rgb.hexValue = '000000';
var newTextLayer = doc.artLayers.add();
newTextLayer.kind = LayerKind.TEXT;
newTextLayer.textItem.kind = TextType.POINTTEXT
newTextLayer.textItem.color = textColor;
newTextLayer.textItem.font = fontName;
newTextLayer.textItem.size = fontSize;
newTextLayer.textItem.contents =Desc + ", " + City + " , " + Country;
newTextLayer.textItem.position = Array(10, Height - (addTextArea/2));
preferences.rulerUnits = originalRulerUnits;
Putting IPTC data into pixels, underneath image
Thats really helpful, thanks very much!
And sorry for the late "Thank you", didn't get around to play with it until yesterday!
And sorry for the late "Thank you", didn't get around to play with it until yesterday!