Copy link to clipboard
Copied
Hello everyone!
After some search on the forums about Adobe Photoshop scripting I found that there is a problem of exporting "Use brush" (Brush Stroke) action to the JavaScript file.
I tried on myself ActionFileToXML.jsx and ActionFileToJavascript.jsx from http://ps-scripts.sourceforge.net/xtools.html after recording some brush strokes via Action Palette, and Photoshop became "frozen".
(When I used "Fill" tool without any brush strokes - saved action file converted without problem)
I also tried Convert Actions File from http://www.tonton-pixel.com/scripts/utility-scripts/convert-actions-file/index.html . Result was the same.
Without recording brush strokes .atn action file converts without problem, but if I try to export action file with recorded brush strokes application becomes "frozen".
I tried to open converted files in the destination folder in hope that they will have brush strokes actions converted to the script - but there was FAIL. This did not happen.
-----
I did some research of this theme and found that .atn files can be viewed via Freeware Hex Editor XVI32 from http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm
And I found that simple action file with commands Set Foreground Color (red) - Fill
will become this:
And another simple action file with commands Set Foreground Color (red) - Fill - Set Foreground Color (yellow) - Select brush - Set current brush - Use brush
will become this:
Please, pay your attention to the right scrollbar, file is really huge.
Action Set - No Brush.atn takes only 1 KB, and Action Set - Brush.atn - 7 423 KB.
I make assumption that this big data is about speed of drawing of the line, pressure of the pen on the tablet, direction of the drawing in each millisecond and so on.
So my question - how to decode this data into the JavaScript? Maybe someone from you, dear users, knows how to operate with such low-level data for further scripting.
In fact, Photoshop somehow understands .atn files and can play "Use brush" commands. So, the solution really exists!
Could you help me, please?
Copy link to clipboard
Copied
Hi,
you're getting the same results I got last time I tried a few years ago – a new interesting way to freeze photoshop
I'm not personally aware of any way to reverse engineer brush strokes, to the best of my knowledge the format is not documented anywhere – but I will sit here patiently waiting for others to reply, it's a very interesting question indeed.
Davide
Copy link to clipboard
Copied
One thing you might want to try is to just let one of the conversion scripts run for an hour or so. I know that ActionFileToJavascript.jsx
has this problem with embedded color profiles. It looked like PS was locked up. Instead, the script was just processing a lot of binary data which looks like it may be the case here.
-X
Copy link to clipboard
Copied
Davide_Barranca, xbytor2, thank you for your responses!
I tried to run ActionFileToJavascript.jsx for converting of Action Set - Brush.atn to JavaScript file.
I waited for 1,5 hours. Unfortunately, Photoshop did not come back alive and I killed the process in the Task Manager.
Tonight I will try this operation again for about 5 hours.
By the way, .atn files which I want to convert take about 11-15 GB each. So if there is such long process of conversion for 7,5 MB file, I really do not have time for conversion of the true big files.
I continue to search for solution around the Internet.
Copy link to clipboard
Copied
Hi!
I tried to run ActionFileToJavascript.jsx for converting of Action Set - Brush.atn (7,5 MB) again. I waited for 8 hours and 20 minutes (I left computer to work while I was sleeping). Result is the same - "frozen" application and lack of the final converted file.
xbytor2, you said that ActionFileToJavascript.jsx has problem with embedded color profiles, which causes slow processing of the binary data. Could you explain problem a little bit further, please? Why do embedded color profiles cause slow speed of the operation?
Copy link to clipboard
Copied
Embedded color profiles are large blocks of binary data as Brush Stroke Action likely is. Reading them from the file is easy enough, but it has to be converted into a form that can be used in an ActionDescriptor. The reverse happens when writing the data to disk as JavaScript. These conversions are time killers.
One other thing that maybe happening is that it maybe crashing the JS interpreter (which I've done before) because of the large volume of the data being converted.
Copy link to clipboard
Copied
xbytor2, thank you for your answer!
And could you tell me, please, or give a link to the material, how "Brush Stroke" action should look in JavaScript?
I got via ScriptListener.8li next code, when I selected Brush Tool:
var idtoolModalStateChanged = stringIDToTypeID( "toolModalStateChanged" );
var desc6 = new ActionDescriptor();
var idLvl = charIDToTypeID( "Lvl " );
desc6.putInteger( idLvl, 0 );
var idStte = charIDToTypeID( "Stte" );
var idStte = charIDToTypeID( "Stte" );
var idexit = stringIDToTypeID( "exit" );
desc6.putEnumerated( idStte, idStte, idexit );
var idTool = charIDToTypeID( "Tool" );
var desc7 = new ActionDescriptor();
var idIdnt = charIDToTypeID( "Idnt" );
desc7.putString( idIdnt, """pntb""" );
var idTtl = charIDToTypeID( "Ttl " );
desc7.putString( idTtl, """Brush Tool""" );
var idTool = charIDToTypeID( "Tool" );
desc6.putObject( idTool, idTool, desc7 );
var idKnd = charIDToTypeID( "Knd " );
var idKnd = charIDToTypeID( "Knd " );
var idPnt = charIDToTypeID( "Pnt " );
desc6.putEnumerated( idKnd, idKnd, idPnt );
var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
desc6.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idtoolModalStateChanged, desc6, DialogModes.NO );
Unfortunately, this script does not allow to record Brush Tool (Allow Tool Recording option in Actions menu becomes disabled and gray).
Copy link to clipboard
Copied
There's answer in r-bin reply (number 12): How to record an action for healing brush/clone tool ?
Copy link to clipboard
Copied
Kukurykus, thank you very much!!!