Editing Actions

Here everybody can post his problems with PhotoLine
MikeFromMesa
Mitglied
Beiträge: 261
Registriert: Sa 22 Nov 2014 16:07

Editing Actions

Beitrag von MikeFromMesa »

I created some Actions that I use when loading raw images, and they work properly, but I would like to edit them. I know I can create new actions and that those actions can call my old actions, but I would like to be able to directly edit the old actions instead. I tried to locate them on my file system, but had no luck.

Is it possible to edit existing actions? And, if so, how?

UPDATE:

Well, I did find the location of the PhotoLine information under the Library folder, and do not understand why I did not see it before, but still have the same question about editing an existing action.
Benutzeravatar
Hoogo
Betatester
Beiträge: 4021
Registriert: So 03 Jul 2005 13:35
Wohnort: Mülheim/Ruhr

Re: Editing Actions

Beitrag von Hoogo »

There is "view > panels > action list (ctrl+alt+shift+Y)"
Less obvious: It has a "button mode" and a more detailed mode.
In buttonmode the list is full of buttons without any details.
Try a right mouse click to go to the other mode.
There you can drag & drop all the entries.
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!
MikeFromMesa
Mitglied
Beiträge: 261
Registriert: Sa 22 Nov 2014 16:07

Re: Editing Actions

Beitrag von MikeFromMesa »

> There is "view > panels > action list (ctrl+alt+shift+Y)"

Yes. I knew about this and had the Actions Panel displayed. I know I can open any action and look at the functions being performed.

> It has a "button mode" and a more detailed mode.

Yes. I knew about this as well. I have tried both and know that the button mode does not display what steps are taken by any particular action while the more detailed mode allows you to look at the individual steps. However it does not provide any way to edit those actions that I have been able to find, and that is what I wanted to do.

> There you can drag & drop all the entries.

Yes, but what I want to do is edit the actions. I am not concerned with dragging and dropping them. If I can edit them I can make changes in fairly complex actions. If I can only create and delete them, I just either go through multiple steps to re-create a complex action or add a call to another action to the first action, and that would not allow me to insert steps in between current steps.
Benutzeravatar
Hoogo
Betatester
Beiträge: 4021
Registriert: So 03 Jul 2005 13:35
Wohnort: Mülheim/Ruhr

Re: Editing Actions

Beitrag von Hoogo »

Now I don't get the problem...
You can move all steps of an action, record new steps, delete steps.
And entries like "curves" open their dialog when you double click them.
So what's missing for you? For me it's all there what I need to edit.
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!
MikeFromMesa
Mitglied
Beiträge: 261
Registriert: Sa 22 Nov 2014 16:07

Re: Editing Actions

Beitrag von MikeFromMesa »

Are you saying that I can go through the steps of an action, one at a time, and while in the middle of the action, record a new step?

If that is correct, I did not know it.
Benutzeravatar
Hoogo
Betatester
Beiträge: 4021
Registriert: So 03 Jul 2005 13:35
Wohnort: Mülheim/Ruhr

Re: Editing Actions

Beitrag von Hoogo »

Maybe that new step will be recorded at the end of the action. But in that case you can drag & drop it to the correct position in the list.
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!
MikeFromMesa
Mitglied
Beiträge: 261
Registriert: Sa 22 Nov 2014 16:07

Re: Editing Actions

Beitrag von MikeFromMesa »

Hoogo hat geschrieben: Sa 09 Dez 2017 01:59 Maybe that new step will be recorded at the end of the action. But in that case you can drag & drop it to the correct position in the list.
I did not know that you could record while playing back an action. If I can add steps, move them around and delete them, then I can see that there is no reason to have an action editor.

Just when I think I have finally figured out the PhotoLine functionality I find that there are even more "goodies" buried in the tool than I knew. Thank you.
cathodeRay
Mitglied
Beiträge: 151
Registriert: So 15 Nov 2015 12:37

Re: Editing Actions

Beitrag von cathodeRay »

Well, I was probably bound to chime in, as this little matter of editing actions has been one of my things.

Yes, they can be sort of edited (changed would probably be more accurate) using the methods Hoogo describes but it is a bit like poking fireworks with a red hot poker - sooner or later something blows up in your face. I also find it very hard to keep an overview of what's going on as well, pending the inevitable big bang.

Ages ago I used Corel PhotoPaint and it had a real scripting language, as in text files you could edit in a text editor, and I have always appreciated that way of doing things. Search and replace, cut and paste, seeing human readable descriptions of what's going on, all that sort of stuff. PL's actions are saved as binary files and cannot be edited, except indirectly (Hoogo's methods).

I have a hunch actions saved in binary format is here to stay. The good news however is that the latest beta version of PL does have scripting, in fact, it seems to have many scripting options. I have yet to try them out (being a tight-wad I haven't shelled out (sic) for the latest version yet). But I think it may hold great promise.

cR
MikeFromMesa
Mitglied
Beiträge: 261
Registriert: Sa 22 Nov 2014 16:07

Re: Editing Actions

Beitrag von MikeFromMesa »

I did not realize that there were public beta versions of PhotoLine. I am currently on version 20, as I just recently updated my version 18 license, so perhaps I can take a look at the version 20 beta.

Thank you for the information. One of the problems I have learning PhotoLine enough to know the answers to all of my (previous) questions is that I do most of my work in workflow tools (usually Dxo's Optics Pro, now PhotoLab) and usually only use PhotoLine for pixel type editing.
Benutzeravatar
russellcottrell
Mitglied
Beiträge: 251
Registriert: Sa 26 Jul 2014 10:13
Wohnort: California

Re: Editing Actions

Beitrag von russellcottrell »

Hello; I have been experimenting with running actions in scripting by passing them as hex strings. If you locate the values of parameters (such as width and height of the emboss filter, for example) in the hex string, you can pass them as parameters as you would for a method or subroutine. Integer values are easy; but the encoding of double float values does not seem to be a standard encoding. 12, for example, should be 40 2a 00 00 00 00 00 00, but in the actions file it is 35 9d d4 00 ff fe 00 00. Are we allowed to ask for the double float encoding method, in a form that we could run in a script?

I am using Frhed to edit the actions file. See https://gregstoll.dyndns.org/~gregstoll/floattohex/ for a description of the conversion process.
Martin Huber
Entwickler
Entwickler
Beiträge: 4161
Registriert: Di 19 Nov 2002 15:49

Re: Editing Actions

Beitrag von Martin Huber »

russellcottrell hat geschrieben: Do 18 Okt 2018 04:11 Hello; I have been experimenting with running actions in scripting by passing them as hex strings. If you locate the values of parameters (such as width and height of the emboss filter, for example) in the hex string, you can pass them as parameters as you would for a method or subroutine. Integer values are easy; but the encoding of double float values does not seem to be a standard encoding. 12, for example, should be 40 2a 00 00 00 00 00 00, but in the actions file it is 35 9d d4 00 ff fe 00 00. Are we allowed to ask for the double float encoding method, in a form that we could run in a script?
Because of historical reasons, PhotoLine actions are storing floating point numbers in a normalized format:
- the mantissa multiplied with 2^30 as 4-byte integer (in big endian format)
- an exponent with the base of 2 as 2-byte integer (in big endian format)
So the resulting float from the saved values is (mantissa / 2^30) * 2^exponent

A pseudo code for converting a double value to this internal format is:

Code: Alles auswählen

double sign
int mantissa
int exponent

exponent = 0
sign = 1
if (value < 0)
   sign = -1
   value = -value
endif

while (value > 1)
   value = value * 0.5
   exponent = exponent + 1
wend

mantissa = int(sign * value * 2^30)
This pseudo code isn't perfect for small values, but should be sufficient.

Martin
Benutzeravatar
russellcottrell
Mitglied
Beiträge: 251
Registriert: Sa 26 Jul 2014 10:13
Wohnort: California

Re: Editing Actions

Beitrag von russellcottrell »

Code: Alles auswählen

Dim num, sign, exponent, expStr, mantissa, manStr, hexStr, re

num = CDbl(InputBox("Please enter a number:"))

If num = 0 Then

  hexStr = "00 00 00 00 00 00"

Else

sign = Sgn(num)
num = Abs(num)

exponent = Int(Log(num) / Log(2)) + 1
expStr = exponent
If expStr < 0 Then
  expStr = &H10000 + expStr
End If
expStr = Hex(expStr)
expStr = String(4-Len(expStr), "0") & expStr

mantissa = Int(sign * (num / (2^exponent)) * (2^30))
manStr = Hex(mantissa)

hexStr = LCase(manStr & expStr)
Set re = New RegExp
re.Global = True
re.Pattern = "(.{2})"
hexStr = re.Replace(hexStr, "$1 ")

End If

MsgBox hexStr
Thank you very much for the information. The above should work with all numbers (within reason); but there are small rounding errors for non-integers.

It looks like some actions follow the above, but others seem to have some sort of correction factor built in, for both the mantissa and the exponent. For example, the Relief filter renders 12 properly as 30 00 00 00 00 04; but in Emboss it is 35 9d d4 00 ff fe, and in Color Correction, Undistort Lens, and Lens Correction it is 3d 70 a3 c0 ff fd.
Martin Huber
Entwickler
Entwickler
Beiträge: 4161
Registriert: Di 19 Nov 2002 15:49

Re: Editing Actions

Beitrag von Martin Huber »

russellcottrell hat geschrieben: Fr 19 Okt 2018 00:31It looks like some actions follow the above, but others seem to have some sort of correction factor built in, for both the mantissa and the exponent. For example, the Relief filter renders 12 properly as 30 00 00 00 00 04; but in Emboss it is 35 9d d4 00 ff fe, and in Color Correction, Undistort Lens, and Lens Correction it is 3d 70 a3 c0 ff fd.
Some actions save degrees as radians, others as degrees. The same is true with percent values: Some use the percent value, others a value normalized to a [0;1] range.

Martin
Benutzeravatar
russellcottrell
Mitglied
Beiträge: 251
Registriert: Sa 26 Jul 2014 10:13
Wohnort: California

Re: Editing Actions

Beitrag von russellcottrell »

Code: Alles auswählen

Dim pl, doc

Set pl = CreateObject("PhotoLine.Application")
Set doc = pl.ActiveDocument

Emboss 135, 12, 8, 16, 5, 0



Sub Emboss(direction, height, width, intensity, curve, mode)
'Emboss PhotoLine script by Russell Cottrell
'direction 0-360
'height 5-90
'width 0-100
'intensity 0-100
'curve 0-5 as below
'mode 0 = Unsharp, 1 = Shade
'pattern is Create From Intensity

Dim hexStr

direction = FloatToHex(direction * (3.14159265358979/180))

height = FloatToHex(height * (3.14159265358979/180))

width = ByteToHex(width)

intensity = FloatToHex(intensity)

Select Case curve
  Case 0
    curve = "000000000000000000000000200000000000200000000000200000000001200000000001" 'straight
  Case 1
    curve = "0000000000000000000000002afe0bc0ffff284121800000200000000001200000000001" 'straight raised
  Case 2
    curve = "00000000000000000000000029c55fc00000314ce400ffff200000000001200000000001" 'straight lowered
  Case 3
    curve = "000000000000200000000001200000000000200000000000200000000001000000000000" 'reversed
  Case 4
    curve = "00000000000020000000000129c55fc0000027598e000000200000000001000000000000" 'reversed raised
  Case 5
    curve = "0000000000002000000000012afe0bc0ffff2f7dbd00ffff200000000001000000000000" 'reversed lowered
  Case 6
    curve = "000000000000000000000000207d11800000200000000001200000000001000000000000" 'arch
  Case 7
    curve = "000000000000200000000001207d11800000000000000000200000000001200000000001" 'U
End Select

mode = ByteToHex(mode)

hexStr = "50686f746f204c696e6520416374696f6e7300000001000000000100ff9b0000000c4772" & _
"6f7570416374696f6e000200000000000000013e02010000000100000004000000010000" & _
"0003000001240000000100ff9b0000000d456d626f7373416374696f6e00010100000000" & _
"000000120201000000010000000400000001ffffffff00000001000000e4000100000000" & _
"0000000000020000000000010000008c0100000000050000000200" & _
mode & _
"0000000000000006" & _
direction & _
"0000000100000006" & _
height & _
"0000000200000006" & _
intensity & _
"0000000300000004000000" & _
width & _
"000000040000003e01000000000000000002000100000001000000260003" & _
curve & _
"ffffffffffffffff00000002000000360100000000000000000200030000000100000006" & _
"3243f6c0000000000002000000040000000300000003000000040000000affffffffffff" & _
"ffffffffffffffffffff000000010000000dff9b00000007456d626f7373000000000200" & _
"00000400000006ffffffff"

doc.DoOperation "Action", "Data", hexStr

End Sub



Function FloatToHex(num)
Dim sign, exponent, expStr, mantissa, manStr, hexStr
If num = 0 Then
  hexStr = "000000000000"
Else
  sign = Sgn(num)
  num = Abs(num)
  exponent = Int(Log(num) / Log(2)) + 1
  expStr = exponent
  If expStr < 0 Then
    expStr = &H10000 + expStr
  End If
  expStr = Hex(expStr)
  expStr = String(4-Len(expStr), "0") & expStr
  mantissa = Int(sign * (num / (2^exponent)) * (2^30))
  manStr = Hex(mantissa)
  hexStr = LCase(manStr & expStr)
End If
FloatToHex = hexStr
End Function



Function ByteToHex(num)
ByteToHex = Right("0" & Hex(num), 2)
End Function
Benutzeravatar
russellcottrell
Mitglied
Beiträge: 251
Registriert: Sa 26 Jul 2014 10:13
Wohnort: California

Re: Editing Actions

Beitrag von russellcottrell »

The PhotoLine Scripted Actions Toolkit:
http://www.russellcottrell.com/photo/Ph ... oolkit.htm