Programming Photoshop with Javascript and turning shapes into code with Illustrator

21
Programming Photoshop with Javascript and turning shapes into code with Illustrator Tom Krcha @tomkrcha Adobe San Francisco

description

Programming Photoshop with Javascript and turning shapes into code with Illustrator. Tom Krcha @ tomkrcha Adobe San Francisco. ExtendScript + JavaScript. ExtendScript Toolkit. Extend Photoshop and Illustrator with custom commands. Sample ExtendScript. Export Styles to JSON. - PowerPoint PPT Presentation

Transcript of Programming Photoshop with Javascript and turning shapes into code with Illustrator

Page 1: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Programming Photoshop with Javascript and turning shapes into code with

IllustratorTom Krcha @tomkrcha

Adobe San Francisco

Page 2: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

ExtendScript + JavaScript

Page 3: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

ExtendScript ToolkitExtend Photoshop and Illustrator with custom commands

Page 4: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Sample ExtendScriptExport Styles to JSON

Page 5: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Adobe GeneratorExtend Photoshop with JavaScript

Page 6: Programming Photoshop with  Javascript and turning shapes into code with Illustrator
Page 7: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Generate Image AssetsExport layers to files in realtime while you

workLayer name suffix convention: @2x, .png, .jpg, .gif, .svg

Page 8: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Export PSD structureIncludes bounds, text format and content, layer styles, blend modes,

fills. Convert into JSON, CSS, HTML, XFL, XIB, NIB//a layer object:

{"id": 20, "index": 9,"bounds": { "bottom": , "left":,

"right": , "top": }, "name": "Just some circles with

FX to test Generator", "type": "layerSection”"visible": true"protection": { "all": true },

"blendOptions": { "mode": "passThrough" },

"smartObject": { … }, "layerEffects": { … }, "layers": [ ],"text" : { },

"fill" : {

"class": "solidColorLayer",

"color": {

"blue": 53.996, "green": 255, "red": 0.004

}

Page 9: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Photoshop to Edge Reflow Exporter

Written with Adobe Generator

Page 10: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Realtime workflow with Generator (Gaming, Loom SDK)

http://www.youtube.com/watch?v=fMxvyB1fMNY

Page 11: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Adobe GeneratorPhotoshop + Node.js + ExtendScript

= + +

Page 12: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Adobe GeneratorIs Open Sourced

Page 13: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Adobe GeneratorGenerator vs. Remote Connections

Page 14: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Adobe Generator APICalls:• getDocumentInfo• getPixmap• savePixmap

• evaluateJSXString• evaluateJSXFile

• alert• addMenuItem

Events:• imageChanged• toolChanged• generatorMenuChanged• currentDocumentChanged

• subscribeToPhotoshopEvent (call)

Page 15: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Show me the code already, ok?

Page 16: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Advanced commands withScriptingListenerJS.log

(low level ActionDescriptor calls in PS)Download from

http://www.adobe.com/devnet/photoshop/scripting.html

Page 17: Programming Photoshop with  Javascript and turning shapes into code with Illustrator
Page 18: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Save as SVG

<path fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" d=”M105,39L9,18C0,0,27,19,20,3C129,44,120,75,120,75L3,20L-18,-9L87,95L3,-20L76,60L20,-3L105,39Z"/>M – moveTo, L – lineTo, C – curveTo, Z - closePath

Page 19: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

DrawscriptTurn Adobe Illustrator vector shapes into

graphics codeHTML5 Canvas, Obj-C iOS, C++ OpenFrameworks, Processing,

CreateJS, Raw points

http://drawscri.pt

Page 20: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Drawscript example

http://drawscri.pt

iOS Skinning with DrawscriptTurn vector shapes into Obj-C

Page 21: Programming Photoshop with  Javascript and turning shapes into code with Illustrator

Tom Krcha @tomkrcha