Modérateur: Modérateurs
Inscription: 04 Fév 2011
Localisation: Béarn
Boitier 1: - Nikon D750
Boitier 2: - Sony NEX-7
Boitier 3: - Nikon D300
Objectif 1: - Nikkor 24-120mm f/3.5-5.6G ED-IF AF-S VR
Objectif 2: - Nikkor 105mm f/2.8D AF Micro
Objectif 3: - Nikkor 70-200mm f/2.8E FL ED AF-S VR
Objectif 4: - Tokina AF 500mm f/8
Objectif 5: - Sony E 10-18mm f/4 OSS
Objectif 6: - Sony E 18-200mm f/3.5-6.3 OSS
Flash 1: - Nikon SB-600
Flash 2: - Nikon SB-700
////////////////////////////////////////////////////////////////////////
///// Base de script pour insertion de calques de texte
/////
///// © Cédric Girard - http://blog.aube-nature.com
////////////////////////////////////////////////////////////////////////</code>
// script ExifCedricGirard_Bon.jsx
//MODIFIE par txuku
//Utiliser le script EXIF_INFOS_BON.jsx
//pour connaitre les numeros des informations exif de son appareil
// numeros a modifier ( valeurs de la variable e ) dans la fonction InfoExif() de ce script
//ligne 87
#target photoshop // Script dédié à Photoshop
app.bringToFront(); // On place Photoshop au premier plan
displayDialogs = DialogModes.NO; // Désactivation des boîtes de dialogue
// Sauvegarde des unités de mesure en cours, et passage en pixels par défaut
var oRulerUnits = preferences.rulerUnits;
var oTypeUnits = preferences.typeUnits;
preferences.rulerUnits = Units.PIXELS;
preferences.typeUnits = TypeUnits.PIXELS;
var DocActif = activeDocument;
// Lecture des informations EXIF contenues dans l'image
try
{
var DocActif = activeDocument; // Document actif (image ouverte au premier plan)
// Définition d'une variable définissant une couleur blanche, que nous utiliseront plus loin
var colorBlanc = new SolidColor();
colorBlanc.rgb.red = 255;
colorBlanc.rgb.blue = 255;
colorBlanc.rgb.green = 255;
// On crée un nouveau calque texte
var oLayer = DocActif.artLayers.add();
oLayer.kind = LayerKind.TEXT; // Type de calque = calque de texte
oLayer.name = "Nom du calque"; // Nom du calque
var oTextItem = oLayer.textItem; // On définit une variable qui permettra de simplifier les accès au calque de texte créé
oTextItem.font = "Century gothic"; // Définition de la police
oTextItem.size = 14; // Définition de la taille de police
oTextItem.color = colorBlanc; // Définition de la couleur du texte
/////////////////////////////////////////////////////////////////////
////////// ZONE MODIFIABLE (insertion de votre texte)
/////////////////////////////////////////////////////////////////////
//////////
// Pour créer un retour à la ligne (parfois utile) insérer "\u000D"
var LesExifs=""; //lire Les Exifs rajout perso
InfoExif(LesExifs);
//alert(LesExifs);
oTextItem.contents = LesExifs; //"ici le texte à ajouter" // Contenu du texte
//////////
//////////
/////////////////////////////////////////////////////////////////////
// Centrage du calque de texte au milieu de la compo (par défaut)
var LargeurTexte = (oLayer.bounds[2] - oLayer.bounds[0]); // Largeur du calque de texte
var HauteurTexte = (oLayer.bounds[3] - oLayer.bounds[1]); // hauteur du calque de texte
oTextItem.position = [(DocActif.width-LargeurTexte) / 2, (DocActif.height-HauteurTexte) / 2];
}
catch(oErreur)
{
// Une erreur est survenue...
alert( "Une erreur est survenue : " + oErreur.description)
}
// Remise en place des unités de mesure initiales
preferences.rulerUnits = oRulerUnits;
preferences.typeUnits = oTypeUnits;
////////// FIN DU SCRIPT ////////////////////////////////////////////
//Fonction personnelle - il faut modifier les valeurs de e en fonction de son boitier
// utiliser le script
function InfoExif()
{
var docRef = activeDocument;
LesExifs="";
// valeurs de e = numeros a modifier dans la fonction InfoExif() suivant les resultats du script Exif_New.jsx
var e = 6; //Modele------------> Modele
LesExifs =LesExifs + " " + docRef.info.exif[e][1]; //LesExifs + docRef.info.exif[e][0] + " = " + docRef.info.exif[e][1] + "\r";
var e = 15; //Vitesse------------> Temps d exposition
LesExifs = LesExifs + " " + docRef.info.exif[e][1]; //LesExifs + docRef.info.exif[e][0] + " = " + docRef.info.exif[e][1] + "\r";
var e = 16; //Ouverture------------> Ouverture du diaphragme
LesExifs = LesExifs + " " + docRef.info.exif[e][1]; //LesExifs + docRef.info.exif[e][0] + " = " + docRef.info.exif[e][1] + "\r";
var e = 18; //Iso 17------------> Vitesse ISO
LesExifs = LesExifs + " ISO" + docRef.info.exif[e][1]; //LesExifs + docRef.info.exif[e][0] + " = " + docRef.info.exif[e][1] + "\r";
var e = 30; //Distance focale ------------> Distance focale
LesExifs = LesExifs + " " + docRef.info.exif[e][1]; //LesExifs + docRef.info.exif[e][0] + " = " + docRef.info.exif[e][1] + "\r";
//var e = 21; //Date------------> Date et heure de l original
//LesExifs = LesExifs + " " + docRef.info.exif[e][1]; //LesExifs + docRef.info.exif[e][0] + " = " + docRef.info.exif[e][1] + "\r";
//catch (e) { alert( "Pas d exif dans cette image !");}
return LesExifs;
}
savedUnits=app.preferences.rulerUnits;
var thisDoc=app.activeDocument;
app.preferences.rulerUnits=Units.PIXELS;
// EXIF_INFOS_BON.jsx
//pour connaitre les numeros des informations exif de son appareil
// numeros a modifier dans la fonction InfoExif() du script EXIF_INFOS_BON.jsx
var exif_info="";
for (var e = 0; e < thisDoc.info.exif.length; e++){
try
{
var j = e ;
if ( j<10 )
{
exif_info = exif_info + "N° " + j + " " +thisDoc.info.exif[e][0] + " = " + thisDoc.info.exif[e][1] + "\r";
}
else
{
exif_info = exif_info + "N° " + j + " " +thisDoc.info.exif[e][0] + " = " + thisDoc.info.exif[e][1] + "\r";
}
}
catch (e) {}
}
// alert(thisDoc.info.exif);
text_layer=thisDoc.artLayers.add();
text_layer.kind = LayerKind.TEXT;
textColor = new SolidColor;
textColor.rgb.red = 0;
textColor.rgb.green = 0;
textColor.rgb.blue = 0;
text_layer.textItem.color = textColor;
text_layer.textItem.kind=TextType.PARAGRAPHTEXT;
text_layer.textItem.position = Array(thisDoc.width * 0.05, thisDoc.height * 0.05);
text_layer.textItem.size = 18; //a la place de 4
text_layer.textItem.font = "ArialMT";
text_layer.textItem.width = thisDoc.width * 0.8
text_layer.textItem.height = thisDoc.height * 0.8
text_layer.textItem.contents=exif_info;
// restore preferences
app.preferences.rulerUnits=savedUnits;
Inscription: 04 Fév 2011
Localisation: Béarn
Boitier 1: - Nikon D750
Boitier 2: - Sony NEX-7
Boitier 3: - Nikon D300
Objectif 1: - Nikkor 24-120mm f/3.5-5.6G ED-IF AF-S VR
Objectif 2: - Nikkor 105mm f/2.8D AF Micro
Objectif 3: - Nikkor 70-200mm f/2.8E FL ED AF-S VR
Objectif 4: - Tokina AF 500mm f/8
Objectif 5: - Sony E 10-18mm f/4 OSS
Objectif 6: - Sony E 18-200mm f/3.5-6.3 OSS
Flash 1: - Nikon SB-600
Flash 2: - Nikon SB-700
Inscription: 04 Fév 2011
Localisation: Béarn
Boitier 1: - Nikon D750
Boitier 2: - Sony NEX-7
Boitier 3: - Nikon D300
Objectif 1: - Nikkor 24-120mm f/3.5-5.6G ED-IF AF-S VR
Objectif 2: - Nikkor 105mm f/2.8D AF Micro
Objectif 3: - Nikkor 70-200mm f/2.8E FL ED AF-S VR
Objectif 4: - Tokina AF 500mm f/8
Objectif 5: - Sony E 10-18mm f/4 OSS
Objectif 6: - Sony E 18-200mm f/3.5-6.3 OSS
Flash 1: - Nikon SB-600
Flash 2: - Nikon SB-700
var e = 30; //Distance focale ------------> Distance focale
var e = 31; //Distance focale ------------> Distance focale
Inscription: 04 Fév 2011
Localisation: Béarn
Boitier 1: - Nikon D750
Boitier 2: - Sony NEX-7
Boitier 3: - Nikon D300
Objectif 1: - Nikkor 24-120mm f/3.5-5.6G ED-IF AF-S VR
Objectif 2: - Nikkor 105mm f/2.8D AF Micro
Objectif 3: - Nikkor 70-200mm f/2.8E FL ED AF-S VR
Objectif 4: - Tokina AF 500mm f/8
Objectif 5: - Sony E 10-18mm f/4 OSS
Objectif 6: - Sony E 18-200mm f/3.5-6.3 OSS
Flash 1: - Nikon SB-600
Flash 2: - Nikon SB-700
Inscription: 04 Fév 2011
Localisation: Béarn
Boitier 1: - Nikon D750
Boitier 2: - Sony NEX-7
Boitier 3: - Nikon D300
Objectif 1: - Nikkor 24-120mm f/3.5-5.6G ED-IF AF-S VR
Objectif 2: - Nikkor 105mm f/2.8D AF Micro
Objectif 3: - Nikkor 70-200mm f/2.8E FL ED AF-S VR
Objectif 4: - Tokina AF 500mm f/8
Objectif 5: - Sony E 10-18mm f/4 OSS
Objectif 6: - Sony E 18-200mm f/3.5-6.3 OSS
Flash 1: - Nikon SB-600
Flash 2: - Nikon SB-700
Inscription: 04 Fév 2011
Localisation: Béarn
Boitier 1: - Nikon D750
Boitier 2: - Sony NEX-7
Boitier 3: - Nikon D300
Objectif 1: - Nikkor 24-120mm f/3.5-5.6G ED-IF AF-S VR
Objectif 2: - Nikkor 105mm f/2.8D AF Micro
Objectif 3: - Nikkor 70-200mm f/2.8E FL ED AF-S VR
Objectif 4: - Tokina AF 500mm f/8
Objectif 5: - Sony E 10-18mm f/4 OSS
Objectif 6: - Sony E 18-200mm f/3.5-6.3 OSS
Flash 1: - Nikon SB-600
Flash 2: - Nikon SB-700
Inscription: 15 Mar 2016
Objectif 1:
// Enables double clicking from the Macintosh Finder or Windows Explorer
#target photoshop
app.bringToFront();
//var topFolder = Folder.selectDialog("Select the top folder where your images are : ");
var topFolder = Folder("/c/_copyright");
if (topFolder != null)
{
filesArray = scanFolder(topFolder);
}
// Opens the first photo found
if (filesArray.length > 0)
{
var docRef = filesArray[0];
app.open (docRef);
}
// Sets the EXIFs of the camera in an array
var exifArray = new Array();
var selectedItems = new Array;
var exifNumber = app.activeDocument.info.exif.length;
for (var i = 0; i < exifNumber; i++)
{
exifArray[i] = (i+1)+" - "+app.activeDocument.info.exif[i][0];
}
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
// User interface
var w = new Window("dialog");
var information = w.add('statictext',undefined,'Press the key Ctrl and select the EXIFs you need.');
var columns = w.add("group");
columns.orientation="row";
var list1 = new Array();
var list2 = new Array();
var halfList = Math.round((exifArray.length)/2);
for (var i=0;i<halfList;i++) // List 1
{
list1[i] = exifArray[i];
}
for (var i=halfList;i<exifNumber;i++) // List 2
{
list2[i-halfList] = exifArray[i];
}
var listExif1 = columns.add ("listbox", undefined,list1,{multiselect:true});
var listExif2 = columns.add ("listbox", undefined,list2,{multiselect:true});
listExif1.onChange = function()
{
alert(listExif1.selection);
selectedItems[selectedItems.length] = listExif1.selection;
}
listExif2.onChange = function()
{
alert(listExif2.selection);
selectedItems[selectedItems.length] = listExif2.selection;
}
var exeButton = w.add ("button", undefined,"Execution");
exeButton.onClick = main;
w.show();
// Puts the selected items in an array
function main()
{
for (var i=0;i<selectedItems.length;i++);
{
alert(selectedItems);
}
w.hide();
}
// Recursive function
function scanFolder(folder) {
var filesArray = [],
fileList = folder.getFiles(),i, file;
for (i = 0; i < fileList.length; i++) {
file = fileList[i];
if (file instanceof Folder) {
filesArray = filesArray.concat(scanFolder(file));
}
else if (file instanceof File && file.name.match(/\.(jpg|)$/i)) {
filesArray.push(file);
}
}
return filesArray;
}
Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 1 invité