SlideShare a Scribd company logo
1 of 46
Except where otherwise noted, this work is licensed
under: http://creativecommons.org/licenses/by-nc-sa/
3.0/
Uso del API Javascript
para obtener fotos HDTR
Leganés, 11 y 12 de febrero
David Gómez G.
Dr Jeckyll & Mr Hide
Haciendo Fotos
desde los 16 años
Exposiciones
Colectivas e indivudales
Ing. técnico en
Informática de sistemas
Sw Engineer & Trainer
@dgomezg@d_v_g
The HDTR technique
Term coined by Martin Krzywinski
HDTR
High Dynamic
Time Range
@dgomezg @D_v_G
The HDTR Technique
Term coined by Martin KrzywinskiHDTR | High Dynamic
Time Range
http://mkweb.bcgsc.ca/fun/hdtr/
Steps
SHOT
Process
Plan
@dgomezg @D_v_G
The Planning
Spot the place
(Find out if its going to
be crowded at sunset)
Find out
when and where
the sun sets
Check the
weather forecast
(A rainy sunset looks
quite different)
@dgomezg @D_v_G
Do you require a Permit?
@dgomezg @D_v_G
Do you require a Permit?
(Even If they’re useless)
When and Where
the sun sets
PhotoPills
@dgomezg @D_v_G
Golden & Blue Hours
in Photography
@dgomezg @D_v_G
Photographic Shot
Keep the camera steady
for several hours
(a TRIPOD will help)
Set a
NEUTRAL White Balace
Keep a const Depth of
Field (Aperture Priority)
Better if you can shot
Tethered to a Computer
Pick some BEERS & FRIENDS
(but pay attention to the camera)
@dgomezg @D_v_G
TOOLS and Setup
Tethered Shooting
Set Aperture Priority
Set timered shooting
(TIMELAPSE SHOOTING)
@dgomezg @D_v_G
RESULTSRESULTS
@dgomezg @D_v_G
Construction of a
HDTR image
@dgomezg @D_v_G
The Photoshop Process
Described at
http://mkweb.bcgsc.ca/fun/hdtr/?tutorial
Automate the
process
Available AT
http://mkweb.bcgsc.ca/fun/hdtr/?CODE
Martin Krzywinski
Implementation
• Perl BASED
• PROS
• Easy setup &
RUN
• FREE
• No dependencies
(but Perl & libs)
• CONS
• Verbose
blending
config
• No tuning
posibility of
result image
@dgomezg @D_v_G
PS Scripting
alternative
• PROS
• Final image un
PSD format with
layers
• You could
further adjust
the result
• Easy config & run
• CONS
• PS License
required
• Harder to code
@dgomezg @D_v_G
PS scripting languages
@dgomezg @D_v_G
Photoshop JS
• Since PHOTOSHOP CS 1
(experimental support in PS 7.0 via an optional
plugin)
• Cross platform
• New DOM To access most of Photoshop
features and properties
@dgomezg @D_v_G
Photoshop’s DOM
• BUT Still some operations not
available: Gradients, Adjustment
Layers, Layer Effects, polygonal
selections....@dgomezg @D_v_G
Access to the “Hidden”
functionality
• JS Classes from original PS SDK
interface
• ActionDescriptor,
• ActionList
• ActionReference
• Use codes as parameters
@dgomezg @D_v_G
Access to the “Hidden” functionality
ScriptListener plugin
//-------------------------------------------------------------
var V1 = new ActionDescriptor();
var V2 = new ActionDescriptor();
V2.putUnitDouble(charIDToTypeID("Hrzn"),charIDToTypeID("#Pxl"), 345);
V2.putUnitDouble(charIDToTypeID("Vrtc"),charIDToTypeID("#Pxl"), 667);
V1.putObject(charIDToTypeID("From"),charIDToTypeID("Pnt "), V2);
var V3 = new ActionDescriptor();
[...]
Records User’s interaction to JS script
var fillWithGradient = function(startX, startY, endX, endY) {
var V1 = new ActionDescriptor();
var V2 = new ActionDescriptor();
V2.putUnitDouble(
charIDToTypeID("Hrzn"),
charIDToTypeID("#Pxl"),
startX); // start point X
V2.putUnitDouble(
charIDToTypeID("Vrtc"),
charIDToTypeID("#Pxl"),
startY); // start point Y
V1.putObject(
charIDToTypeID("From"),
charIDToTypeID("Pnt "), V2);
var V3 = new ActionDescriptor();
Access to the “Hidden” functionality
Code translation
//-------------------------------------------------------------
var V1 = new ActionDescriptor();
var V2 = new ActionDescriptor();
V2.putUnitDouble(charIDToTypeID("Hrzn"),charIDToTypeID("#Pxl"), 345);
V2.putUnitDouble(charIDToTypeID("Vrtc"),charIDToTypeID("#Pxl"), 667);
V1.putObject(charIDToTypeID("From"),charIDToTypeID("Pnt "), V2);
var V3 = new ActionDescriptor();
[...]
Translating codes
/*
lMID.maskHides = 1214529900;//"HdAl"
lMID.maskRevealsAll = 1383492673;//"RvlA"
lMID.maskReveals = 1383492691;//"Rvls"
lMID.mask = 1299409696;//"Msk "
lMID.at = 1098129440;//"At "
lMID.using = 1433628263;//"Usng"
lMID.userMask = 1433629261;//"UsrM"
lMID.make = 1298866208;//"Mk "
lMID.property = 1349677170;//"Prpr"
...
*/
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
Photoshop Extended
Script
• SOME Photoshop classes are defined in
an extended and particular way
alert(app.activeDocument.height);
#include "modules/json/json.js"
alert(JSON.stringify(app.activeDocument.height));
Photoshop
ExtendScript
.JSX .JS
Convention
ExtendScript files Regular files
not using special Adobe
classes and functions
@dgomezg @D_v_G
DEVELOPMENT TOOLS
ExtendScript Toolkit
DEVELOPMENT TOOLS
ExtendScript Toolkit
• Delivered with every Creative Suite
product
• Need to set the target application
• Combo
• #target
• Benefits
• run on application
• Debug tools
• Inspector
DEVELOPMENT TOOLS
Any other JS editor
Launch script via File > Scripts > Browse ...
@dgomezg @D_v_G
the Photoshop
HDTR.jsx script
Process config
var hdtrConfig = {
direction : Direction.VERTICAL
, guidesOffset : 5
, maskOffset : 25
, guideSpacing : function () {
if (this.direction == Direction.VERTICAL) {
return this.docDimensions.width / this.shots;
} else {
return this.docDimensions.height / this.shots;
}
}
};
Added later:
- Image (document) dimensions
- Number of original shots
- Blending Offset (in Pixels # of Columns)
Source file selection
& further config
var files = app.openDialog();
hdtrConfig.shots = files.length;
hdtrConfig.docDimensions = getImageFileDimensions(files[0]);
hdtrConfig.offset =
hdtrConfig.maskOffset * hdtrConfig.guideSpacing();
var getImageFileDimensions = function(file) {
var imageDocument = app.open(file);
var documentDimensions = { "height" : document.height,
"width" : document.width,
"resolution" : document.resolution};
imageDocument.close();
return documentDimensions;
}
HDTR document
var hdtrDocument = app.documents.add(
hdtrConfig.docDimensions.width,
hdtrConfig.docDimensions.height,
hdtrConfig.docDimensions.resolution);
drawGuides(hdtrDocument, hdtrConfig.direction, hdtrConfig.shots);
var drawGuides = function(document, direction, number) {
var distance = (direction == Direction.HORIZONTAL)?
document.height / number :
document.width / number ;
for (var i = 0; i < number + 1; i++) {
var position;
position = i * distance;
document.guides.add(direction,
new UnitValue(position, position));
}
}
Main Loop
var refGuide;
var from;
var to;
for (index = 0; index < files.length; index++) {
addLayerFromFile(hdtrDocument, files[index]);
if (index > 0) {
refGuide = hdtrDocument.guides[index];
from = refGuide.coordinate - hdtrConfig.offset;
to = refGuide.coordinate + hdtrConfig.offset;
createLayerMask(hdtrDocument, hdtrDocument.activeLayer, false);
fillWithGradient(from, hdtrConfig.docDimensions.height /2,
to, hdtrConfig.docDimensions.height /2);
}
}
@dgomezg @D_v_G
Add Layer from File
var addLayerFromFile = function(hdtrDocument, file) {
var sourceDocument = app.open(file);
app.activeDocument = sourceDocument;
app.activeDocument.activeLayer.copy();
app.activeDocument = hdtrDocument;
hdtrDocument.paste();
hdtrDocument.activeLayer.name =
(hdtrDocument.artLayers.length -1) + "-" + sourceDocument.name;
sourceDocument.close();
}
@dgomezg @D_v_G
Create Layer Mask
var createLayerMask = function(doc, layer, fromSelection) {
var desc = new ActionDescriptor();
desc.putClass(cTID("Nw "), cTID("Chnl"));
var ref = new ActionReference();
ref.putEnumerated(cTID("Chnl"), cTID("Chnl"), cTID("Msk "));
desc.putReference(cTID("At "), ref);
if (fromSelection == true) {
desc.putEnumerated(cTID("Usng"), cTID("UsrM"), cTID("RvlS"));
} else {
desc.putEnumerated(cTID("Usng"), cTID("UsrM"), cTID("RvlA"));
}
executeAction(cTID("Mk "), desc, DialogModes.NO);
}
@dgomezg @D_v_G
Fill with Gradient
var fillWithGradient = function(startX, startY, endX, endY) {
var V1 = new ActionDescriptor();
var V2 = new ActionDescriptor();
V2.putUnitDouble(
charIDToTypeID("Hrzn"),
charIDToTypeID("#Pxl"),
startX); // start point X
V2.putUnitDouble(
charIDToTypeID("Vrtc"),
charIDToTypeID("#Pxl"),
startY); // start point Y
V1.putObject(
charIDToTypeID("From"),
charIDToTypeID("Pnt "), V2);
var V3 = new ActionDescriptor();
....
Better to see the source code
DEMO TIME!
Next Steps
Heterogeneous slice
distribution
@dgomezg @D_v_G
Easier configuration
Using Photoshop UI
Photoshop CS1
User Interaction via Alerts
Photoshop CS2
Added ScriptUI
(page 187 of PS CS2 JS Reference)
Photoshop CS3+
ScriptUI moved to PS JS TOOLS GUIDE
@dgomezg @D_v_G
Script UI
var dlg = new Window("dialog{text:'Script Interface',bounds:[100,100,561,269],
iwtfkhamhc:EditText{bounds:[16,16,444.95,94] , text:'Your text goes here' ,properties:
{multiline:false,noecho:false,readonly:false}},
button0:Button{bounds:[17,102,117,122] , text:'Save' },
button1:Button{bounds:[236,101,336,121] , text:'Cancel' },
button2:Button{bounds:[345,101,445,121] , text:'Whatever' },
slider0:Slider{bounds:[18,138,173,148] , minvalue:0,maxvalue:100,value:0},
checkbox0:Checkbox{bounds:[190,133,261,154] , text:'Checkbox Text' },
dropdown0:DropDownList{bounds:[299,134,443,149],properties:{items:['Select One']}}
};");
dlg.show();
@dgomezg @D_v_G
Further Reference
http://kcy.me/l7uohttp://kcy.me/l7ur
@dgomezg @D_v_G
Q & A
Thanks
@d_v_g
@dgomezg
https://github.com/dgomezg/hdtr-photoshop-js

More Related Content

What's hot

Vavr Java User Group Rheinland
Vavr Java User Group RheinlandVavr Java User Group Rheinland
Vavr Java User Group RheinlandDavid Schmitz
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsMongoDB
 
Creating a Java EE 7 Websocket Chat Application
Creating a Java EE 7 Websocket Chat ApplicationCreating a Java EE 7 Websocket Chat Application
Creating a Java EE 7 Websocket Chat ApplicationMicha Kops
 
Vaadin 7 Today and Tomorrow
Vaadin 7 Today and TomorrowVaadin 7 Today and Tomorrow
Vaadin 7 Today and TomorrowJoonas Lehtinen
 
Concept of BlockChain & Decentralized Application
Concept of BlockChain & Decentralized ApplicationConcept of BlockChain & Decentralized Application
Concept of BlockChain & Decentralized ApplicationSeiji Takahashi
 
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode Objects
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode ObjectsEWD 3 Training Course Part 22: Traversing Documents using DocumentNode Objects
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode ObjectsRob Tweed
 
Dynamic C++ Silicon Valley Code Camp 2012
Dynamic C++ Silicon Valley Code Camp 2012Dynamic C++ Silicon Valley Code Camp 2012
Dynamic C++ Silicon Valley Code Camp 2012aleks-f
 
"The little big project. From zero to hero in two weeks with 3 front-end engi...
"The little big project. From zero to hero in two weeks with 3 front-end engi..."The little big project. From zero to hero in two weeks with 3 front-end engi...
"The little big project. From zero to hero in two weeks with 3 front-end engi...Fwdays
 
LJC Conference 2014 Cassandra for Java Developers
LJC Conference 2014 Cassandra for Java DevelopersLJC Conference 2014 Cassandra for Java Developers
LJC Conference 2014 Cassandra for Java DevelopersChristopher Batey
 
EWD 3 Training Course Part 21: Persistent JavaScript Objects
EWD 3 Training Course Part 21: Persistent JavaScript ObjectsEWD 3 Training Course Part 21: Persistent JavaScript Objects
EWD 3 Training Course Part 21: Persistent JavaScript ObjectsRob Tweed
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseSages
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksMongoDB
 
Ken 20150306 心得分享
Ken 20150306 心得分享Ken 20150306 心得分享
Ken 20150306 心得分享LearningTech
 
Weaponizing the Windows API with Metasploit's Railgun
Weaponizing the Windows API with Metasploit's RailgunWeaponizing the Windows API with Metasploit's Railgun
Weaponizing the Windows API with Metasploit's RailgunTheLightcosine
 
Reutov, yunusov, nagibin random numbers take ii
Reutov, yunusov, nagibin   random numbers take iiReutov, yunusov, nagibin   random numbers take ii
Reutov, yunusov, nagibin random numbers take iiDefconRussia
 
(Greach 2015) Dsl'ing your Groovy
(Greach 2015) Dsl'ing your Groovy(Greach 2015) Dsl'ing your Groovy
(Greach 2015) Dsl'ing your GroovyAlonso Torres
 

What's hot (19)

Vavr Java User Group Rheinland
Vavr Java User Group RheinlandVavr Java User Group Rheinland
Vavr Java User Group Rheinland
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
 
Creating a Java EE 7 Websocket Chat Application
Creating a Java EE 7 Websocket Chat ApplicationCreating a Java EE 7 Websocket Chat Application
Creating a Java EE 7 Websocket Chat Application
 
Vaadin 7 Today and Tomorrow
Vaadin 7 Today and TomorrowVaadin 7 Today and Tomorrow
Vaadin 7 Today and Tomorrow
 
Concept of BlockChain & Decentralized Application
Concept of BlockChain & Decentralized ApplicationConcept of BlockChain & Decentralized Application
Concept of BlockChain & Decentralized Application
 
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode Objects
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode ObjectsEWD 3 Training Course Part 22: Traversing Documents using DocumentNode Objects
EWD 3 Training Course Part 22: Traversing Documents using DocumentNode Objects
 
Jersey Guice AOP
Jersey Guice AOPJersey Guice AOP
Jersey Guice AOP
 
Dynamic C++ Silicon Valley Code Camp 2012
Dynamic C++ Silicon Valley Code Camp 2012Dynamic C++ Silicon Valley Code Camp 2012
Dynamic C++ Silicon Valley Code Camp 2012
 
"The little big project. From zero to hero in two weeks with 3 front-end engi...
"The little big project. From zero to hero in two weeks with 3 front-end engi..."The little big project. From zero to hero in two weeks with 3 front-end engi...
"The little big project. From zero to hero in two weeks with 3 front-end engi...
 
LJC Conference 2014 Cassandra for Java Developers
LJC Conference 2014 Cassandra for Java DevelopersLJC Conference 2014 Cassandra for Java Developers
LJC Conference 2014 Cassandra for Java Developers
 
EWD 3 Training Course Part 21: Persistent JavaScript Objects
EWD 3 Training Course Part 21: Persistent JavaScript ObjectsEWD 3 Training Course Part 21: Persistent JavaScript Objects
EWD 3 Training Course Part 21: Persistent JavaScript Objects
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
Ac2
Ac2Ac2
Ac2
 
Ken 20150306 心得分享
Ken 20150306 心得分享Ken 20150306 心得分享
Ken 20150306 心得分享
 
Weaponizing the Windows API with Metasploit's Railgun
Weaponizing the Windows API with Metasploit's RailgunWeaponizing the Windows API with Metasploit's Railgun
Weaponizing the Windows API with Metasploit's Railgun
 
Reutov, yunusov, nagibin random numbers take ii
Reutov, yunusov, nagibin   random numbers take iiReutov, yunusov, nagibin   random numbers take ii
Reutov, yunusov, nagibin random numbers take ii
 
(Greach 2015) Dsl'ing your Groovy
(Greach 2015) Dsl'ing your Groovy(Greach 2015) Dsl'ing your Groovy
(Greach 2015) Dsl'ing your Groovy
 
Return of c++
Return of c++Return of c++
Return of c++
 

Similar to T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR

"Enabling Googley microservices with gRPC" Riga DevDays 2018 edition
"Enabling Googley microservices with gRPC" Riga DevDays 2018 edition"Enabling Googley microservices with gRPC" Riga DevDays 2018 edition
"Enabling Googley microservices with gRPC" Riga DevDays 2018 editionAlex Borysov
 
Full-Stack Data Science: How to be a One-person Data Team
Full-Stack Data Science: How to be a One-person Data TeamFull-Stack Data Science: How to be a One-person Data Team
Full-Stack Data Science: How to be a One-person Data TeamGreg Goltsov
 
5 x HTML5 worth using in APEX (5)
5 x HTML5 worth using in APEX (5)5 x HTML5 worth using in APEX (5)
5 x HTML5 worth using in APEX (5)Christian Rokitta
 
Nko workshop - node js crud & deploy
Nko workshop - node js crud & deployNko workshop - node js crud & deploy
Nko workshop - node js crud & deploySimon Su
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on AndroidSven Haiges
 
NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)Chris Richardson
 
CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourCouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourPeter Friese
 
Giving a URL to All Objects using Beacons²
Giving a URL to All Objects using Beacons²Giving a URL to All Objects using Beacons²
Giving a URL to All Objects using Beacons²All Things Open
 
Eddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All ObjectsEddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All ObjectsJeff Prestes
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Remy Sharp
 
Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02PL dream
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best PracticesYekmer Simsek
 
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016Luigi Dell'Aquila
 
Migrating data into Drupal using the migrate module
Migrating data into Drupal using the migrate moduleMigrating data into Drupal using the migrate module
Migrating data into Drupal using the migrate moduleJohan Gant
 

Similar to T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR (20)

"Enabling Googley microservices with gRPC" Riga DevDays 2018 edition
"Enabling Googley microservices with gRPC" Riga DevDays 2018 edition"Enabling Googley microservices with gRPC" Riga DevDays 2018 edition
"Enabling Googley microservices with gRPC" Riga DevDays 2018 edition
 
HTML5 - Pedro Rosa
HTML5 - Pedro RosaHTML5 - Pedro Rosa
HTML5 - Pedro Rosa
 
Full-Stack Data Science: How to be a One-person Data Team
Full-Stack Data Science: How to be a One-person Data TeamFull-Stack Data Science: How to be a One-person Data Team
Full-Stack Data Science: How to be a One-person Data Team
 
5 x HTML5 worth using in APEX (5)
5 x HTML5 worth using in APEX (5)5 x HTML5 worth using in APEX (5)
5 x HTML5 worth using in APEX (5)
 
Nko workshop - node js crud & deploy
Nko workshop - node js crud & deployNko workshop - node js crud & deploy
Nko workshop - node js crud & deploy
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)
 
Fact, Fiction, and FP
Fact, Fiction, and FPFact, Fiction, and FP
Fact, Fiction, and FP
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
Introduction to angular js
Introduction to angular jsIntroduction to angular js
Introduction to angular js
 
CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourCouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 Hour
 
Giving a URL to All Objects using Beacons²
Giving a URL to All Objects using Beacons²Giving a URL to All Objects using Beacons²
Giving a URL to All Objects using Beacons²
 
Eddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All ObjectsEddystone Beacons - Physical Web - Giving a URL to All Objects
Eddystone Beacons - Physical Web - Giving a URL to All Objects
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
 
Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
 
Android Sample Project By Wael Almadhoun
Android Sample Project By Wael AlmadhounAndroid Sample Project By Wael Almadhoun
Android Sample Project By Wael Almadhoun
 
Dex Technical Seminar (April 2011)
Dex Technical Seminar (April 2011)Dex Technical Seminar (April 2011)
Dex Technical Seminar (April 2011)
 
Migrating data into Drupal using the migrate module
Migrating data into Drupal using the migrate moduleMigrating data into Drupal using the migrate module
Migrating data into Drupal using the migrate module
 

More from David Gómez García

Leverage CompletableFutures to handle async queries. DevNexus 2022
Leverage CompletableFutures to handle async queries. DevNexus 2022Leverage CompletableFutures to handle async queries. DevNexus 2022
Leverage CompletableFutures to handle async queries. DevNexus 2022David Gómez García
 
Building Modular monliths that could scale to microservices (only if they nee...
Building Modular monliths that could scale to microservices (only if they nee...Building Modular monliths that could scale to microservices (only if they nee...
Building Modular monliths that could scale to microservices (only if they nee...David Gómez García
 
Building modular monoliths that could scale to microservices (only if they ne...
Building modular monoliths that could scale to microservices (only if they ne...Building modular monoliths that could scale to microservices (only if they ne...
Building modular monoliths that could scale to microservices (only if they ne...David Gómez García
 
Leveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results AsynchrhonouslyLeveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results AsynchrhonouslyDavid Gómez García
 
Builiding Modular monoliths that can scale to microservices. JBCNConf 2021
Builiding Modular monoliths that can scale to microservices. JBCNConf 2021Builiding Modular monoliths that can scale to microservices. JBCNConf 2021
Builiding Modular monoliths that can scale to microservices. JBCNConf 2021David Gómez García
 
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
Cdm mil-18 - hypermedia ap is for headless platforms and data integrationCdm mil-18 - hypermedia ap is for headless platforms and data integration
Cdm mil-18 - hypermedia ap is for headless platforms and data integrationDavid Gómez García
 
What's in a community like Liferay's
What's in a community like Liferay'sWhat's in a community like Liferay's
What's in a community like Liferay'sDavid Gómez García
 
Java9 Beyond Modularity - Java 9 más allá de la modularidad
Java9 Beyond Modularity - Java 9 más allá de la modularidadJava9 Beyond Modularity - Java 9 más allá de la modularidad
Java9 Beyond Modularity - Java 9 más allá de la modularidadDavid Gómez García
 
Managing user's data with Spring Session
Managing user's data with Spring SessionManaging user's data with Spring Session
Managing user's data with Spring SessionDavid Gómez García
 
Construccion de proyectos con gradle
Construccion de proyectos con gradleConstruccion de proyectos con gradle
Construccion de proyectos con gradleDavid Gómez García
 
Java 8 Stream API. A different way to process collections.
Java 8 Stream API. A different way to process collections.Java 8 Stream API. A different way to process collections.
Java 8 Stream API. A different way to process collections.David Gómez García
 
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)David Gómez García
 
Measuring Code Quality in WTF/min.
Measuring Code Quality in WTF/min. Measuring Code Quality in WTF/min.
Measuring Code Quality in WTF/min. David Gómez García
 
El poder del creador de Software. Entre la ingeniería y la artesanía
El poder del creador de Software. Entre la ingeniería y la artesaníaEl poder del creador de Software. Entre la ingeniería y la artesanía
El poder del creador de Software. Entre la ingeniería y la artesaníaDavid Gómez García
 
A real systemwithjms-rest-protobuf-mongodb
A real systemwithjms-rest-protobuf-mongodbA real systemwithjms-rest-protobuf-mongodb
A real systemwithjms-rest-protobuf-mongodbDavid Gómez García
 

More from David Gómez García (20)

Leverage CompletableFutures to handle async queries. DevNexus 2022
Leverage CompletableFutures to handle async queries. DevNexus 2022Leverage CompletableFutures to handle async queries. DevNexus 2022
Leverage CompletableFutures to handle async queries. DevNexus 2022
 
Building Modular monliths that could scale to microservices (only if they nee...
Building Modular monliths that could scale to microservices (only if they nee...Building Modular monliths that could scale to microservices (only if they nee...
Building Modular monliths that could scale to microservices (only if they nee...
 
Building modular monoliths that could scale to microservices (only if they ne...
Building modular monoliths that could scale to microservices (only if they ne...Building modular monoliths that could scale to microservices (only if they ne...
Building modular monoliths that could scale to microservices (only if they ne...
 
Leveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results AsynchrhonouslyLeveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results Asynchrhonously
 
Builiding Modular monoliths that can scale to microservices. JBCNConf 2021
Builiding Modular monoliths that can scale to microservices. JBCNConf 2021Builiding Modular monoliths that can scale to microservices. JBCNConf 2021
Builiding Modular monoliths that can scale to microservices. JBCNConf 2021
 
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
Cdm mil-18 - hypermedia ap is for headless platforms and data integrationCdm mil-18 - hypermedia ap is for headless platforms and data integration
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
 
What's in a community like Liferay's
What's in a community like Liferay'sWhat's in a community like Liferay's
What's in a community like Liferay's
 
Java9 Beyond Modularity - Java 9 más allá de la modularidad
Java9 Beyond Modularity - Java 9 más allá de la modularidadJava9 Beyond Modularity - Java 9 más allá de la modularidad
Java9 Beyond Modularity - Java 9 más allá de la modularidad
 
Managing user's data with Spring Session
Managing user's data with Spring SessionManaging user's data with Spring Session
Managing user's data with Spring Session
 
Parallel streams in java 8
Parallel streams in java 8Parallel streams in java 8
Parallel streams in java 8
 
Construccion de proyectos con gradle
Construccion de proyectos con gradleConstruccion de proyectos con gradle
Construccion de proyectos con gradle
 
Java 8 Stream API. A different way to process collections.
Java 8 Stream API. A different way to process collections.Java 8 Stream API. A different way to process collections.
Java 8 Stream API. A different way to process collections.
 
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
 
Measuring Code Quality in WTF/min.
Measuring Code Quality in WTF/min. Measuring Code Quality in WTF/min.
Measuring Code Quality in WTF/min.
 
Spring4 whats up doc?
Spring4 whats up doc?Spring4 whats up doc?
Spring4 whats up doc?
 
Gradle como alternativa a maven
Gradle como alternativa a mavenGradle como alternativa a maven
Gradle como alternativa a maven
 
El poder del creador de Software. Entre la ingeniería y la artesanía
El poder del creador de Software. Entre la ingeniería y la artesaníaEl poder del creador de Software. Entre la ingeniería y la artesanía
El poder del creador de Software. Entre la ingeniería y la artesanía
 
Geo-SentimentZ
Geo-SentimentZGeo-SentimentZ
Geo-SentimentZ
 
Wtf per lineofcode
Wtf per lineofcodeWtf per lineofcode
Wtf per lineofcode
 
A real systemwithjms-rest-protobuf-mongodb
A real systemwithjms-rest-protobuf-mongodbA real systemwithjms-rest-protobuf-mongodb
A real systemwithjms-rest-protobuf-mongodb
 

Recently uploaded

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR

  • 1. Except where otherwise noted, this work is licensed under: http://creativecommons.org/licenses/by-nc-sa/ 3.0/ Uso del API Javascript para obtener fotos HDTR Leganés, 11 y 12 de febrero David Gómez G.
  • 2. Dr Jeckyll & Mr Hide Haciendo Fotos desde los 16 años Exposiciones Colectivas e indivudales Ing. técnico en Informática de sistemas Sw Engineer & Trainer @dgomezg@d_v_g
  • 3. The HDTR technique Term coined by Martin Krzywinski HDTR High Dynamic Time Range @dgomezg @D_v_G
  • 4. The HDTR Technique Term coined by Martin KrzywinskiHDTR | High Dynamic Time Range http://mkweb.bcgsc.ca/fun/hdtr/
  • 6. The Planning Spot the place (Find out if its going to be crowded at sunset) Find out when and where the sun sets Check the weather forecast (A rainy sunset looks quite different) @dgomezg @D_v_G
  • 7. Do you require a Permit? @dgomezg @D_v_G
  • 8. Do you require a Permit? (Even If they’re useless)
  • 11. Golden & Blue Hours in Photography @dgomezg @D_v_G
  • 12. Photographic Shot Keep the camera steady for several hours (a TRIPOD will help) Set a NEUTRAL White Balace Keep a const Depth of Field (Aperture Priority) Better if you can shot Tethered to a Computer Pick some BEERS & FRIENDS (but pay attention to the camera) @dgomezg @D_v_G
  • 13. TOOLS and Setup Tethered Shooting Set Aperture Priority Set timered shooting (TIMELAPSE SHOOTING) @dgomezg @D_v_G
  • 15. Construction of a HDTR image @dgomezg @D_v_G
  • 16. The Photoshop Process Described at http://mkweb.bcgsc.ca/fun/hdtr/?tutorial
  • 18. Available AT http://mkweb.bcgsc.ca/fun/hdtr/?CODE Martin Krzywinski Implementation • Perl BASED • PROS • Easy setup & RUN • FREE • No dependencies (but Perl & libs) • CONS • Verbose blending config • No tuning posibility of result image @dgomezg @D_v_G
  • 19. PS Scripting alternative • PROS • Final image un PSD format with layers • You could further adjust the result • Easy config & run • CONS • PS License required • Harder to code @dgomezg @D_v_G
  • 21. Photoshop JS • Since PHOTOSHOP CS 1 (experimental support in PS 7.0 via an optional plugin) • Cross platform • New DOM To access most of Photoshop features and properties @dgomezg @D_v_G
  • 22. Photoshop’s DOM • BUT Still some operations not available: Gradients, Adjustment Layers, Layer Effects, polygonal selections....@dgomezg @D_v_G
  • 23. Access to the “Hidden” functionality • JS Classes from original PS SDK interface • ActionDescriptor, • ActionList • ActionReference • Use codes as parameters @dgomezg @D_v_G
  • 24. Access to the “Hidden” functionality ScriptListener plugin //------------------------------------------------------------- var V1 = new ActionDescriptor(); var V2 = new ActionDescriptor(); V2.putUnitDouble(charIDToTypeID("Hrzn"),charIDToTypeID("#Pxl"), 345); V2.putUnitDouble(charIDToTypeID("Vrtc"),charIDToTypeID("#Pxl"), 667); V1.putObject(charIDToTypeID("From"),charIDToTypeID("Pnt "), V2); var V3 = new ActionDescriptor(); [...] Records User’s interaction to JS script var fillWithGradient = function(startX, startY, endX, endY) { var V1 = new ActionDescriptor(); var V2 = new ActionDescriptor(); V2.putUnitDouble( charIDToTypeID("Hrzn"), charIDToTypeID("#Pxl"), startX); // start point X V2.putUnitDouble( charIDToTypeID("Vrtc"), charIDToTypeID("#Pxl"), startY); // start point Y V1.putObject( charIDToTypeID("From"), charIDToTypeID("Pnt "), V2); var V3 = new ActionDescriptor();
  • 25. Access to the “Hidden” functionality Code translation //------------------------------------------------------------- var V1 = new ActionDescriptor(); var V2 = new ActionDescriptor(); V2.putUnitDouble(charIDToTypeID("Hrzn"),charIDToTypeID("#Pxl"), 345); V2.putUnitDouble(charIDToTypeID("Vrtc"),charIDToTypeID("#Pxl"), 667); V1.putObject(charIDToTypeID("From"),charIDToTypeID("Pnt "), V2); var V3 = new ActionDescriptor(); [...] Translating codes /* lMID.maskHides = 1214529900;//"HdAl" lMID.maskRevealsAll = 1383492673;//"RvlA" lMID.maskReveals = 1383492691;//"Rvls" lMID.mask = 1299409696;//"Msk " lMID.at = 1098129440;//"At " lMID.using = 1433628263;//"Usng" lMID.userMask = 1433629261;//"UsrM" lMID.make = 1298866208;//"Mk " lMID.property = 1349677170;//"Prpr" ... */ cTID = function(s) { return app.charIDToTypeID(s); }; sTID = function(s) { return app.stringIDToTypeID(s); };
  • 26. Photoshop Extended Script • SOME Photoshop classes are defined in an extended and particular way alert(app.activeDocument.height); #include "modules/json/json.js" alert(JSON.stringify(app.activeDocument.height));
  • 27. Photoshop ExtendScript .JSX .JS Convention ExtendScript files Regular files not using special Adobe classes and functions @dgomezg @D_v_G
  • 29. DEVELOPMENT TOOLS ExtendScript Toolkit • Delivered with every Creative Suite product • Need to set the target application • Combo • #target • Benefits • run on application • Debug tools • Inspector
  • 30. DEVELOPMENT TOOLS Any other JS editor Launch script via File > Scripts > Browse ... @dgomezg @D_v_G
  • 32. Process config var hdtrConfig = { direction : Direction.VERTICAL , guidesOffset : 5 , maskOffset : 25 , guideSpacing : function () { if (this.direction == Direction.VERTICAL) { return this.docDimensions.width / this.shots; } else { return this.docDimensions.height / this.shots; } } }; Added later: - Image (document) dimensions - Number of original shots - Blending Offset (in Pixels # of Columns)
  • 33. Source file selection & further config var files = app.openDialog(); hdtrConfig.shots = files.length; hdtrConfig.docDimensions = getImageFileDimensions(files[0]); hdtrConfig.offset = hdtrConfig.maskOffset * hdtrConfig.guideSpacing(); var getImageFileDimensions = function(file) { var imageDocument = app.open(file); var documentDimensions = { "height" : document.height, "width" : document.width, "resolution" : document.resolution}; imageDocument.close(); return documentDimensions; }
  • 34. HDTR document var hdtrDocument = app.documents.add( hdtrConfig.docDimensions.width, hdtrConfig.docDimensions.height, hdtrConfig.docDimensions.resolution); drawGuides(hdtrDocument, hdtrConfig.direction, hdtrConfig.shots); var drawGuides = function(document, direction, number) { var distance = (direction == Direction.HORIZONTAL)? document.height / number : document.width / number ; for (var i = 0; i < number + 1; i++) { var position; position = i * distance; document.guides.add(direction, new UnitValue(position, position)); } }
  • 35. Main Loop var refGuide; var from; var to; for (index = 0; index < files.length; index++) { addLayerFromFile(hdtrDocument, files[index]); if (index > 0) { refGuide = hdtrDocument.guides[index]; from = refGuide.coordinate - hdtrConfig.offset; to = refGuide.coordinate + hdtrConfig.offset; createLayerMask(hdtrDocument, hdtrDocument.activeLayer, false); fillWithGradient(from, hdtrConfig.docDimensions.height /2, to, hdtrConfig.docDimensions.height /2); } } @dgomezg @D_v_G
  • 36. Add Layer from File var addLayerFromFile = function(hdtrDocument, file) { var sourceDocument = app.open(file); app.activeDocument = sourceDocument; app.activeDocument.activeLayer.copy(); app.activeDocument = hdtrDocument; hdtrDocument.paste(); hdtrDocument.activeLayer.name = (hdtrDocument.artLayers.length -1) + "-" + sourceDocument.name; sourceDocument.close(); } @dgomezg @D_v_G
  • 37. Create Layer Mask var createLayerMask = function(doc, layer, fromSelection) { var desc = new ActionDescriptor(); desc.putClass(cTID("Nw "), cTID("Chnl")); var ref = new ActionReference(); ref.putEnumerated(cTID("Chnl"), cTID("Chnl"), cTID("Msk ")); desc.putReference(cTID("At "), ref); if (fromSelection == true) { desc.putEnumerated(cTID("Usng"), cTID("UsrM"), cTID("RvlS")); } else { desc.putEnumerated(cTID("Usng"), cTID("UsrM"), cTID("RvlA")); } executeAction(cTID("Mk "), desc, DialogModes.NO); } @dgomezg @D_v_G
  • 38. Fill with Gradient var fillWithGradient = function(startX, startY, endX, endY) { var V1 = new ActionDescriptor(); var V2 = new ActionDescriptor(); V2.putUnitDouble( charIDToTypeID("Hrzn"), charIDToTypeID("#Pxl"), startX); // start point X V2.putUnitDouble( charIDToTypeID("Vrtc"), charIDToTypeID("#Pxl"), startY); // start point Y V1.putObject( charIDToTypeID("From"), charIDToTypeID("Pnt "), V2); var V3 = new ActionDescriptor(); .... Better to see the source code
  • 42. Easier configuration Using Photoshop UI Photoshop CS1 User Interaction via Alerts Photoshop CS2 Added ScriptUI (page 187 of PS CS2 JS Reference) Photoshop CS3+ ScriptUI moved to PS JS TOOLS GUIDE @dgomezg @D_v_G
  • 43. Script UI var dlg = new Window("dialog{text:'Script Interface',bounds:[100,100,561,269], iwtfkhamhc:EditText{bounds:[16,16,444.95,94] , text:'Your text goes here' ,properties: {multiline:false,noecho:false,readonly:false}}, button0:Button{bounds:[17,102,117,122] , text:'Save' }, button1:Button{bounds:[236,101,336,121] , text:'Cancel' }, button2:Button{bounds:[345,101,445,121] , text:'Whatever' }, slider0:Slider{bounds:[18,138,173,148] , minvalue:0,maxvalue:100,value:0}, checkbox0:Checkbox{bounds:[190,133,261,154] , text:'Checkbox Text' }, dropdown0:DropDownList{bounds:[299,134,443,149],properties:{items:['Select One']}} };"); dlg.show(); @dgomezg @D_v_G
  • 45. Q & A