Ghoul Fool
Engaged
Ghoul Fool
Engaged
Activity
‎Feb 23, 2022
11:57 AM
Sadly, that fails on line 7. Running PS 19.16, if that helps
... View more
‎Feb 23, 2022
08:25 AM
This is setting text, or text tools. which is the same; but different 🙂
... View more
‎Feb 23, 2022
06:40 AM
Taking a stab at Action Manager code. I want to be able to set the antialiasing in the tool to none without having to set any text. Hence using AM code: It's a wild stab in the dark with a blindfold on: var idMk = charIDToTypeID( "Mk " );
var desc11046 = new ActionDescriptor();
var ref2274 = new ActionReference();
var idAntA = charIDToTypeID( "AntA" );
var idPrpr = charIDToTypeID( "Prpr" );
ref2274.putProperty( idPrpr, idAntA );
var idAnnt = charIDToTypeID( "Annt" );
var idAnno = charIDToTypeID( "Anno" );
var idantiAliasNone = stringIDToTypeID( "antiAliasNone" );
desc11046.putEnumerated( idAntA, idAnnt, idantiAliasNone );
executeAction( idMk, desc11046, DialogModes.NO );
Sadly, it doesn't work but I don't know why or where. Any ideas?
... View more
‎Feb 22, 2022
01:20 AM
It's dollars not pounds, and it doesn't mention Action Manager code explicitly, just "all the aspects of Scripting development". That link is: https://www.ps-scripting.com/ps-scripting.html
... View more
‎Feb 21, 2022
01:43 AM
I've ben scripting Photoshop with Javacript for a bit now*, and maybe it's time to go to the deep end and tackle Action Manager code. Trouble is, it's not well documented or widely reported. And since it's not very human readable, which makes things more "interesting" for peiople like me. Can anyone recommend any good starting points ? - and I'm not talking about the £150 course. Cheers * 10 years or more now...
... View more
‎Feb 18, 2022
01:50 AM
That's a tiny thing of beauty! Thank you.
... View more
‎Jan 08, 2022
08:38 AM
Yes, that's what I've just figureed out. - After getting soooo confused. 😞 The code above only works if the image is indexed mode. I was hoping it would force it to load the palette and change from RGB to index mode with said palette in one go. That said, I've managed to get around it by changing it to index prior to loading the palette. index_colour_it("Adpt");
function index_colour_it(palettestyle, num)
{
// forces image to be 256 colours
// =======================================================
if (num == undefined) num = 256;
if (palettestyle == undefined) palettestyle = "Perc";
// could be "Sele" selective or
// "Adpt" adaptive
// "Perc" perceptual
var idCnvM = charIDToTypeID( "CnvM" );
var desc1729 = new ActionDescriptor();
var idT = charIDToTypeID( "T " );
var desc1730 = new ActionDescriptor();
var idPlt = charIDToTypeID( "Plt " );
var idClrP = charIDToTypeID( "ClrP" );
var idPerc = charIDToTypeID( palettestyle ); // Stye
desc1730.putEnumerated( idPlt, idClrP, idPerc );
var idClrs = charIDToTypeID( "Clrs" );
desc1730.putInteger( idClrs, num ); // number of colours
var idFrcC = charIDToTypeID( "FrcC" );
var idFrcC = charIDToTypeID( "FrcC" );
var idNone = charIDToTypeID( "None" );
desc1730.putEnumerated( idFrcC, idFrcC, idNone );
var idTrns = charIDToTypeID( "Trns" );
desc1730.putBoolean( idTrns, false );
var idIndC = charIDToTypeID( "IndC" );
desc1729.putObject( idT, idIndC, desc1730 );
executeAction( idCnvM, desc1729, DialogModes.NO );
}
... View more
‎Jan 08, 2022
06:46 AM
The snippet from here may work for r-bin, but it doesn't work for me in '22 var myPaletteFile = "D:\temp\4.act";
load_palette(myPaletteFile);
function load_palette(afilename)
{
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("color"), stringIDToTypeID("colorTable"));
d.putReference(stringIDToTypeID("null"), r);
d.putPath(stringIDToTypeID("to"), new File(afilename));
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
} I get the error: Error 8800: General Photoshop error occurred. This functionality may not be available in this version of Photoshop. The command "Set" is not currently available. -> Line 11 executeAction(stringIDToTypeID("set"), d, DialogModes.NO)
... View more
‎Jan 07, 2022
04:22 AM
Sorry, I'm autistic and have trouble saying what I mean clearly to others somethimes. Basically the equivilant of Image > Mode > Color Table... > Custom > Load... (pick a .ACT file)
... View more
‎Jan 06, 2022
01:11 AM
That's expoting it. I can already do that. Trying to load an existing .act back in without having save a temporary .psd, and get the data from it, that's something else.
... View more
‎Jan 05, 2022
08:15 AM
This should be straightforward, I want to load a colour table .ACT from a script only the code from the scriptlistener explicitly looks at each RGB entry: // =======================================================
var idCnvM = charIDToTypeID( "CnvM" );
var desc13758 = new ActionDescriptor();
var idT = charIDToTypeID( "T " );
var desc13759 = new ActionDescriptor();
var idCstP = charIDToTypeID( "CstP" );
var list1363 = new ActionList();
var desc13760 = new ActionDescriptor();
var idRd = charIDToTypeID( "Rd " );
desc13760.putDouble( idRd, 196.000000 );
var idGrn = charIDToTypeID( "Grn " );
desc13760.putDouble( idGrn, 28.000000 );
var idBl = charIDToTypeID( "Bl " );
desc13760.putDouble( idBl, 56.000000 );
var idRGBC = charIDToTypeID( "RGBC" );
list1363.putObject( idRGBC, desc13760 );
var desc13761 = new ActionDescriptor();
var idRd = charIDToTypeID( "Rd " );
desc13761.putDouble( idRd, 96.000000 );
var idGrn = charIDToTypeID( "Grn " );
desc13761.putDouble( idGrn, 96.000000 );
var idBl = charIDToTypeID( "Bl " );
desc13761.putDouble( idBl, 128.000000 );
var idRGBC = charIDToTypeID( "RGBC" );
list1363.putObject( idRGBC, desc13761 );
var desc13762 = new ActionDescriptor();
var idRd = charIDToTypeID( "Rd " );
desc13762.putDouble( idRd, 129.000000 );
var idGrn = charIDToTypeID( "Grn " );
desc13762.putDouble( idGrn, 127.000000 );
var idBl = charIDToTypeID( "Bl " );
desc13762.putDouble( idBl, 127.000000 );
var idRGBC = charIDToTypeID( "RGBC" );
list1363.putObject( idRGBC, desc13762 );
var desc13763 = new ActionDescriptor();
var idRd = charIDToTypeID( "Rd " );
desc13763.putDouble( idRd, 93.000000 );
var idGrn = charIDToTypeID( "Grn " );
desc13763.putDouble( idGrn, 93.000000 );
var idBl = charIDToTypeID( "Bl " );
desc13763.putDouble( idBl, 93.000000 );
var idRGBC = charIDToTypeID( "RGBC" );
list1363.putObject( idRGBC, desc13763 );
desc13759.putList( idCstP, list1363 );
var idIndC = charIDToTypeID( "IndC" );
desc13758.putObject( idT, idIndC, desc13759 );
executeAction( idCnvM, desc13758, DialogModes.NO );
Not what I'm after. Also the code is very ugly, and that's only for 4 colours and is incrementally longer for more colour values. Is there the equivilant of this? Image > Mode > Color Table... > Custom > Load... (pick mypalette.act) : load_palette("C:\mypalette.act";
function load_palette(apath)
{
// magic code here
} . Cheers.
... View more
‎Dec 17, 2021
01:28 AM
That's close. The value came out as 60.16845703125, 92.6736744371094, -60.763671875
// rounded up
61, 93, -60 // should be 60 94 -60
... View more
‎Dec 16, 2021
09:36 AM
Sorry that first line should be: var myRGB = [255, 0, 255]; / 60 94 -60
... View more
‎Dec 16, 2021
09:32 AM
I'm having trouble returning the expected values from Photoshop's LAB colour values In RGB colour space var myRGB = [146, 163, 173]; // LAB 60 94 -60
var lab = RGB_to_LAB(myRGB);
lab[0] = round_up(lab[0], 0);
lab[1] = round_up(lab[1], 0);
lab[2] = round_up(lab[2], 0);
alert(lab) // 66, -5, -7
// should be 60 94 -60
function RGB_to_LAB(RGB)
{
var colour = new SolidColor;
colour.rgb.red = RGB[0];
colour.rgb.green = RGB[1];
colour.rgb.blue = RGB[2];
return [
colour.lab.l,
colour.lab.a,
colour.lab.b
]
}
function round_up(num, prec)
{
prec = Math.pow(10, prec);
return Math.ceil(num * prec) / prec;
} I *assuming* the values displayed in the Color Picker are rounded up. I'm sure it's got to do with gamma/ color settings, I'm using sRGB IEC61966-2.1 How do I compensate for any discrepancies? I'm having to feed colours into a colour range function which only works with LAB colours. Nice.
... View more
‎Dec 07, 2021
06:10 AM
I'm using Photoshop 19.1.6 on Win 7
... View more
‎Dec 06, 2021
08:07 AM
That might be a Windows 7 thing then. No need for a fix, then, eh? 😉
... View more
‎Dec 03, 2021
07:54 AM
You can crash Photoshop with an omission in a single line of code: app.activeDocument.selection.stroke("FF0000", 1, StrokeLocation.INSIDE); No warnings, noo errors, just gone! You should, however, be using new Solid colour: var myHexCol = new SolidColor;
myHexCol.rgb.hexValue = "ff0000";
app.activeDocument.selection.stroke(myHexCol, 1, StrokeLocation.INSIDE); Photoshop scripting is reasonable stable, with the exception of using text. But this is a new one. Others should know.
... View more
‎Nov 23, 2021
06:00 AM
I'm still trying to work out the RGB values of a single pantone swatch in ASE format, which is discussed here My swatch is as follows when viewed in hexeditor: The colour when imported into Photoshop is RGB 255, 215, 0 or #FFD700 in hex I can find D7 and (the next) 00 but there is no FF (255 value)? What am I missing?
... View more
‎Nov 10, 2021
06:09 AM
In Photoshop, I can change a layer color (in the layers window) to violet with:
var idsetd = charIDToTypeID( "setd" );
var desc5146 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1552 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref1552.putEnumerated( idLyr, idOrdn, idTrgt );
desc5146.putReference( idnull, ref1552 );
var idT = charIDToTypeID( "T " );
var desc5147 = new ActionDescriptor();
var idClr = charIDToTypeID( "Clr " );
var idClr = charIDToTypeID( "Clr " );
var idVlt = charIDToTypeID( "Vlt " );
desc5147.putEnumerated( idClr, idClr, idVlt );
var idLyr = charIDToTypeID( "Lyr " );
desc5146.putObject( idT, idLyr, desc5147 );
executeAction( idsetd, desc5146, DialogModes.NO );
Is there a way to detect such a layer has been changed from "no color" to red or orange? Get, rather than set? There doesn't seem to be an art layer property for this.
... View more
‎Nov 10, 2021
02:27 AM
2 Upvotes
I'm suprised that there isn't a Photoshop UI lock device. yes you can save workspace and customise the toolbar, and load them in again. But there is no functionality to stop you accidentally removing a menu. Why is that?
... View more
‎May 18, 2021
11:53 AM
I created an accidental typo in a line of code for a Photoshop script: var x = parseFloat(app.activeDocument..activeLayer.bounds[0]); See where I went wrong... .. instead of . It should have been var x = parseFloat(app.activeDocument.activeLayer.bounds[0]); However, the error I got was: XML.descendants() cannot work with instances of this class And it got me thinking, what does that error actually refer to? - not that I was using XML in this case. Does double dot in this case, break dot notation?
... View more
‎May 18, 2021
11:26 AM
It's a rhetorical opening gambit 🙂
... View more
‎May 18, 2021
07:02 AM
So Adobe, why does Photoshop scripting still use ECMA version 3 (circa December 1999)? The request for Photoshop ECMA script to join the 21st century by davidebarranca four years ago has been largely ignored or denied. scripting-extendscript-support-for-ecmascript-6th-version/ Rhetorically, why can't we use nice things like .map(), .filter() .firstIndexOf()?
... View more
‎May 18, 2021
01:30 AM
Got a lovely email from Adobe this morning telling me that they are removing Morisawa japanese fonts from their collection. This is the list of fonts not longer available from the font library on September 10, 2021 https://helpx.adobe.com/fonts/user-guide.html/fonts/using/morisawa-removal.ug.html Needle meet haystack. Technical support are not aware of this and/or were unable to help me. I'd like a list of the postscript names so I can find which files are affected and further impacts on my business. Thank you - Ghoul
... View more
‎Feb 09, 2021
05:18 AM
Thans JJ. But that's not quite what I'm after. Possibly a bit of communication confusion on my behalf. #actuallyautistic Your function allows a selection with a number of settings to be performed on that selection. What I'm after is just to be able to switch all the anti-aliasing buttons off, do some work, and then switch them back on again. So for simplicty's sake, let's consider the marquee tool. I'd just toggle the antialias button on and off. Think of it as a lofi,-retro pixel art mode. and then back to glorius normal Photoshop mode.
... View more
‎Feb 08, 2021
11:27 AM
The fill tool? Haha, I'm old skool, in Photoshop, it's the paint bucket tool.
... View more
‎Feb 08, 2021
07:02 AM
Is there a way in Photoshop to easily switch rectangluar marquee, oval marquie, magic wand and fill to not use anti-aliasing in one go? Not individual tools. In that, I often to pixel art and want to switch all anti-aliasing settings to off and then back on again when I'm done. I don't think this is possible via scripting, tool settings, workspace settings.
... View more
‎Feb 01, 2021
05:37 AM
1 Upvote
That's a beautiful thing, there!
... View more
‎Feb 01, 2021
03:00 AM
It's easy in Photoshop to grab a layer and move where you want. Not so easy to move a layer up or down relative to the currently active layer using code. Which, ironically should be straight forward. // Switch off any dialog boxes
displayDialogs = DialogModes.ALL; // OFF
shift_layer(-1);
// Set Display Dialogs back to normal
displayDialogs = DialogModes.ALL; // NORMAL
// function SHIFT LAYER (direction)
// --------------------------------------------------------
function shift_layer(direction)
{
// direction = 1 Moves layer up 1 place to top
// direction = -1 Moves layer down 1 place to background
if(direction == undefined) return -1;
var where = (direction > 0) ? ElementPlacement.PLACEBEFORE : ElementPlacement.PLACEAFTER;
var currentActiveLayer = app.activeDocument.activeLayer;
var idx = get_layer_index(currentActiveLayer);
// Get a reference to the active layer
var layerRef = app.activeDocument.layers[idx-direction];
// Move the new layer set to after the previously first layer
currentActiveLayer.move(layerRef, where);
}
function get_layer_index(ref)
{
var numOfArtLayers = app.activeDocument.layers.length;
// work from the top of the stack down!
for (var i = numOfArtLayers -1; i >= 0; i--)
{
var tempLayer = app.activeDocument.layers[i];
if (tempLayer == ref) return i;
}
} Only with groups (layersets) this falls apart faster than a carboard umbrella. Is there an easy way to do this? ie get the reference layer & current layer in order to swap them? And using layer names is out of the question.
... View more
‎Jan 06, 2021
01:33 AM
I'm trying to discover a way of detecting transparent pixels. More over if an image is on a transparent background. Looking at the four corner pixels will be sufficient. Only I don't think there's a way to detect RGBA as if the code below is run on a transparent pixels it throws an General Photoshop 8800 error. Any ideas? Apart from a try/catch and or trying to copy paste said pixels. // Add a Color Sampler at a given x and y coordinate in the image.
var pointSample = app.activeDocument.colorSamplers.add([(x),(y)]);
// Obtain array of RGB values.
var rgb = [
pointSample.color.rgb.red,
pointSample.color.rgb.green,
pointSample.color.rgb.blue
];
... View more
- « Previous
- Next »