Render.ru

Фото с датой создания

FSe®g

Пользователь сайта
Рейтинг
2
#1
Помогите пожалуйста.
Как автоматически вставить текст содержащий дату съемки из EXIF.
 

monter

Знаток
Рейтинг
35
#2
// addExifDate1.4.js version 1.4 (06/2004)

// prints the exif creation date and a comment on the given positon (see settings)
// new in version 1.1: looks now for "Date Time Original" - string
// new in version 1.2: layerproperties changed, textsize depends on imagesize, vOffset
// 1.3 works also in PS CS
// 1.4 variable Fontcolor and Outline

//*************************************************************
// if you find this script useful, please donate a fair amount
// to any relief organisation you like.
//*************************************************************

// Copyright (c) Michael Exner (michael.exner@gmx.at)


// ***************************** SETTINGS ***************************


var textSize = 13 // Textsize (% of shorter Imagesize)

var textFont = "ArialNarrow" // Font of added text

var comment = " " // additional text or comment printed in front of date

var hOffset = 98 // hor. offset in % (1 is left, 100 is right)

var vOffset = 95 // vert. offset in % (1 is on top, 100 is on the bottom)

var noTime = 1 // 1...don't print time
// 0...print time after date

var red = 255; // Fontcolor R-Value
var green = 255; // Fontcolor G-Value
var blue = 255; // Fontcolor B-Value

var outline = 0; // Outline (0 is black, 255 is white)


// ***************************** SETTINGS END ***************************

var textColor = new SolidColor;
textColor.rgb.red = red;
textColor.rgb.green = green;
textColor.rgb.blue = blue;


if ( documents.length > 0 )
{
var originalRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
displayDialogs = DialogModes.NO;

try
{

var docRef = activeDocument;

var hoehe = activeDocument.height;
var breite = activeDocument.width;


var myLayerRef = docRef.artLayers.add();
myLayerRef.kind = LayerKind.TEXT;
var i=1;
while (i<30)
{

var exifDate = docRef.info.exif.toString();
if (i==30)
{
exifDate = ""
}
if (exifDate.substring(0,18)=="Date Time Original")
{
i=29
}
i++
}

var docDate = exifDate.substring(27, 29) + "." + exifDate.substring(24, 26) + "." + exifDate.substring(19, 23)
var docTime = exifDate.substring(30, 35)

if (noTime == 0)
{
docTime = "";
}

if (hoehe > breite)
{
var bezug = breite;
}
else
{
var bezug = hoehe;
}

myLayerRef.name = docDate;
var myTextRef = myLayerRef.textItem;
myTextRef.font = textFont;
myTextRef.color = textColor;
myTextRef.size = (bezug * textSize / 300);

myTextRef.justification = Justification.LEFT;

if ( hOffset > 50 )
{
myTextRef.justification = Justification.RIGHT;
}

myTextRef.position = new Array( docRef.width*hOffset/100, docRef.height*vOffset/100 );
myTextRef.contents = comment + docDate + " " + docTime;

layerProperties()


}

catch( e )
{
preferences.rulerUnits = originalRulerUnits;
throw e;
}

preferences.rulerUnits = originalRulerUnits;
flatImage();

}
else
{
alert( "You must have a document open to add the creation date!" );
}



function flatImage()
{
var id2901 = charIDToTypeID( "FltI" );
executeAction( id2901, undefined, DialogModes.NO );
}



function layerProperties()
{
// =======================================================
var id360 = charIDToTypeID( "setd" );
var desc34 = new ActionDescriptor();
var id361 = charIDToTypeID( "null" );
var ref7 = new ActionReference();
var id362 = charIDToTypeID( "Prpr" );
var id363 = charIDToTypeID( "Lefx" );
ref7.putProperty( id362, id363 );
var id364 = charIDToTypeID( "Lyr " );
var id365 = charIDToTypeID( "Ordn" );
var id366 = charIDToTypeID( "Trgt" );
ref7.putEnumerated( id364, id365, id366 );
desc34.putReference( id361, ref7 );
var id367 = charIDToTypeID( "T " );
var desc35 = new ActionDescriptor();
var id368 = charIDToTypeID( "Scl " );
var id369 = charIDToTypeID( "#Prc" );
desc35.putUnitDouble( id368, id369, 416.666667 );
var id370 = charIDToTypeID( "OrGl" );
var desc36 = new ActionDescriptor();
var id371 = charIDToTypeID( "enab" );
desc36.putBoolean( id371, true );
var id372 = charIDToTypeID( "Md " );
var id373 = charIDToTypeID( "BlnM" );
var id374 = charIDToTypeID( "Nrml" );
desc36.putEnumerated( id372, id373, id374 );
var id375 = charIDToTypeID( "Clr " );
var desc37 = new ActionDescriptor();
var id376 = charIDToTypeID( "Rd " );
desc37.putDouble( id376, outline );
var id377 = charIDToTypeID( "Grn " );
desc37.putDouble( id377, outline );
var id378 = charIDToTypeID( "Bl " );
desc37.putDouble( id378, outline );
var id379 = charIDToTypeID( "RGBC" );
desc36.putObject( id375, id379, desc37 );
var id380 = charIDToTypeID( "Opct" );
var id381 = charIDToTypeID( "#Prc" );
desc36.putUnitDouble( id380, id381, 100.000000 );
var id382 = charIDToTypeID( "GlwT" );
var id383 = charIDToTypeID( "BETE" );
var id384 = charIDToTypeID( "SfBL" );
desc36.putEnumerated( id382, id383, id384 );
var id385 = charIDToTypeID( "Ckmt" );
var id386 = charIDToTypeID( "#Pxl" );
desc36.putUnitDouble( id385, id386, 100.000000 );
var id387 = charIDToTypeID( "blur" );
var id388 = charIDToTypeID( "#Pxl" );
desc36.putUnitDouble( id387, id388, 3.000000 );
var id389 = charIDToTypeID( "Nose" );
var id390 = charIDToTypeID( "#Prc" );
desc36.putUnitDouble( id389, id390, 0.000000 );
var id391 = charIDToTypeID( "ShdN" );
var id392 = charIDToTypeID( "#Prc" );
desc36.putUnitDouble( id391, id392, 0.000000 );
var id393 = charIDToTypeID( "AntA" );
desc36.putBoolean( id393, false );
var id394 = charIDToTypeID( "TrnS" );
var desc38 = new ActionDescriptor();
var id395 = charIDToTypeID( "Nm " );
desc38.putString( id395, "Standard" );
var id396 = charIDToTypeID( "Crv " );
var list8 = new ActionList();
var desc39 = new ActionDescriptor();
var id397 = charIDToTypeID( "Hrzn" );
desc39.putDouble( id397, 0.000000 );
var id398 = charIDToTypeID( "Vrtc" );
desc39.putDouble( id398, 0.000000 );
var id399 = charIDToTypeID( "CrPt" );
list8.putObject( id399, desc39 );
var desc40 = new ActionDescriptor();
var id400 = charIDToTypeID( "Hrzn" );
desc40.putDouble( id400, 255.000000 );
var id401 = charIDToTypeID( "Vrtc" );
desc40.putDouble( id401, 255.000000 );
var id402 = charIDToTypeID( "CrPt" );
list8.putObject( id402, desc40 );
desc38.putList( id396, list8 );
var id403 = charIDToTypeID( "ShpC" );
desc36.putObject( id394, id403, desc38 );
var id404 = charIDToTypeID( "Inpr" );
var id405 = charIDToTypeID( "#Prc" );
desc36.putUnitDouble( id404, id405, 100.000000 );
var id406 = charIDToTypeID( "OrGl" );
desc35.putObject( id370, id406, desc36 );
var id407 = charIDToTypeID( "Lefx" );
desc34.putObject( id367, id407, desc35 );
executeAction( id360, desc34, DialogModes.NO );
}
 
#3
А попроще, найди бесплатную прграмулину, Exifer называется, вот она тебе все автоматом вставит, и многое другое, для любителя самое то, если не заморачиваться.
 

FSe®g

Пользователь сайта
Рейтинг
2
#4
Прошу прощения. Я не программист.
Что мне с этим кодом надо сделать. Куда его вставить то надо.
 

FSe®g

Пользователь сайта
Рейтинг
2
#5
Я не объяснил для чего мне всё это нужно.
Я в фотошопе открываю фото и создаю слой с текстом (датой), и применяю разные эффекты (взависимости от картинки). А вот чтобы вставить дату я копирую ее из ACDSee.

Вопрос:
Нельзя ли средствами фотошопа сделать это автоматически?
 

monter

Знаток
Рейтинг
35
#6
см здесь, там и скрипт прикреплен, а то я попробовал сделать отсюда копи/паст и скрипт выдал ошибку в 122 строке.
http://forum.rudtp.ru/showthread.php?t=11575

C:\Program Files\Adobe\Photoshop CS\Presets\Scripts\S_date_time.js

Автоматом много фоток через Batch...
 
Сверху