The PhotoLine Scripted Actions Toolkit
Examples
emboss.js
emboss(135, 12, 8, 16, 5, 0); function emboss(direction, height, width, intensity, curveShape, mode) { // emboss PhotoLine script by Russell Cottrell // direction: 0-360 // height: 5-90 // width: 0-100 // intensity: 0-100 // curveShape: 0-7 as below // mode: 0 = Unsharp, 1 = Shade // pattern is Create From Intensity var pl = new ActiveXObject("PhotoLine.Application"); var doc = pl.ActiveDocument; var hexStr; direction = floatToHex(direction * (3.14159265358979/180)); height = floatToHex(height * (3.14159265358979/180)); width = byteToHex(width); intensity = floatToHex(intensity); switch(curveShape) { case 0: curveShape = "000000000000000000000000200000000000200000000000200000000001200000000001"; // straight break; case 1: curveShape = "0000000000000000000000002afe0bc0ffff284121800000200000000001200000000001"; // straight raised break; case 2: curveShape = "00000000000000000000000029c55fc00000314ce400ffff200000000001200000000001"; // straight lowered break; case 3: curveShape = "000000000000200000000001200000000000200000000000200000000001000000000000"; // reversed break; case 4: curveShape = "00000000000020000000000129c55fc0000027598e000000200000000001000000000000"; // reversed raised break; case 5: curveShape = "0000000000002000000000012afe0bc0ffff2f7dbd00ffff200000000001000000000000"; // reversed lowered break; case 6: curveShape = "000000000000000000000000207d11800000200000000001200000000001000000000000"; // arch break; case 7: curveShape = "000000000000200000000001207d11800000000000000000200000000001200000000001"; // U break; } mode = byteToHex(mode); hexStr = "50686f746f204c696e6520416374696f6e7300000001000000000100ff9b0000000d456d" + "626f7373416374696f6e00010100000000000000120201000000010000000400000001ff" + "ffffff00000001000000e40001000000000000000000020000000000010000008c010000" + "0000050000000200" + mode + "0000000000000006" + direction + "0000000100000006" + height + "0000000200000006" + intensity + "0000000300000004000000" + width + "000000040000003e01000000000000000002000100000001000000260003" + curveShape + "ffffffffffffffff00000002000000360100000000000000000200030000000100000006" + "3243f6c0000000000002000000040000000300000003000000040000000affffffffffff" + "ffffffffffff"; doc.DoOperation("Action", "Data", hexStr); } function floatToHex(num) { var hexStr, s, exp, expStr, len, man, manStr; if (num == 0) hexStr = "000000000000"; else { s = (num < 0 ? -1 : 1); num = Math.abs(num); exp = Math.floor(Math.log(num) / Math.log(2)) + 1; expStr = exp; if (expStr < 0) expStr += 0x10000; expStr = expStr.toString(16); len = expStr.length; for (var i=0; i<4-len; i++) expStr = "0" + expStr; man = Math.floor(s * (num / Math.pow(2, exp)) * Math.pow(2, 30)); if (s < 0) man += 0x100000000; manStr = man.toString(16); hexStr = manStr + expStr; } return hexStr; } function byteToHex(num) { var str = "00" + Math.round(num).toString(16); return str.substr(str.length - 2); }
layerToRGB.js
layerToRGB(); function layerToRGB() { // Converts the active layer to an 8-bit RGB layer. var pl = new ActiveXObject("PhotoLine.Application"); var doc = pl.ActiveDocument; var base64Str; base64Str = "UGhvdG8gTGluZSBBY3Rpb25zAAAAAQAAAAABAP+bAAAADkNvbnZlcnRBY3Rpb24AAgAAAAAA" + "AAAAEgIBAAAAAQAAAAQAAAAB/////wAAAAEAAAACAAEAAAACAAAABAAAAAD/////"; doc.DoOperation("Action", "Data", base64Str); }