Affinity photo as external editor - how to

I don’t have OSX but from what I know you can start any application from command promp by “open APPLICATIONNAME” and to find the application names this article could of help - I hope

But then I’m not sure.

What is the path you copied? Are you getting any errors?

@peterdb I don’t have OS X, but this is likely to work:

  1. Find out the name of the Affinity Photo executable. In a console, type:
    affinity[tab][tab]
    The tab will auto-complete the word, in case the executable’s name is more than just “affinity”, maybe “affinity-photo” or “affinityphoto” etc. Once you have the full name, hit enter to run it. If it runs, you got the right name. If it does not, for example if “affinity[tab][tab]” doesn’t auto-complete it, then maybe try “Affinity[tab][tab]” with a capital “A”.
  2. Find out the full path to the executable. Once you found the name of the executable in step 1, find out the full path to it using the “whereis” command. For example if the result of step 1 ends up being “AffinityPhoto.app”, then type:
    whereis AffinityPhoto.app
  3. Now check whether files can be passed as arguments to the executable. Assuming you have a sample image in /home/peter/a photo.jpg and that the result of step 2 was “/Applications/AffinityPhoto.app”, type:
    /Applications/AffinityPhoto.app "/home/peter/aphoto.jpg"
    Note that the photo path is surrounded by quotation marks (parentheses).
    Affinity Photo should open with your photo loaded.
  4. Enter the full executable path from step 2 into Preferences > External Editor, probably without parentheses, e.g.:
    /Applications/AffinityPhoto.app

Code: https://github.com/Beep6581/RawTherapee/blob/master/rtgui/extprog.cc#L323

Hi,
the path tat I copied is
/Applications/Affinity Photo Trial.app
Using this in RT gives the error : ‘cannot start editor / please set the correct path in preferences’
So probably have to copy another path within the affinity map in Finder… Any ideas ?

Yes: do that long thing I wrote, especially point 3, and report if it goes wrong with detailed info.

Thank you Morgan, but seems to complicated for my still limited knowledge of Osx.
Martin : thanks for the link. Tried that out and came to the same path : /Applications/Affinity Photo Trial.app.
I’ll sent an email to the developers of Affinity too. Could the reason be that I’m using a trialversion of Affinity for now ?

Further information
I can indicate Affinity as an external editor in for example Nikon View Nxi. I checked the path there used and it’s the same as described above. RT seems not to handle this.

have you tried to start affinity from command prompt?

I think it would be:
open -a “/Applications/Affinity Photo Trial.app”

not sure about whether to use the " or not, just thinking because of the blank in the app name.

1 Like

I turned on my Mac and got it to work.

The path you need is /Applications/Affinity\ Photo\ Trial.app/Contents/MacOS/Affinity\ Photo\ Trial

It seems that Affinity does not like being asked to open more than once though, which I’m sure will be annoying. And of course, the path will change, I’m guessing, if you buy the full version.

This works as well and doesn’t crash Affinity when opening multiple photos as my command above does.

1 Like

@Morgan_Hardwood

comparing those lines in the source code you have linked

line 302:
#elif defined __APPLE__ const auto cmdLine = Glib::ustring("open -a \'") + Glib::build_filename(options.psDir, "Photoshop.app\' ") + Glib::ustring("\'") + fileName + Glib::ustring("\'");
and line 321:

#elif defined __APPLE__ const auto cmdLine = options.customEditorProg + Glib::ustring(" \"") + fileName + Glib::ustring("\"");
and asuming starting apps in osx is always the same way, then this “open -a” would be needed to be typed in for all other apps.

and as options.customEditorProg of line 321 is not put in “” those would have to be typed in as well.

ups, a little too slow as @paperdigits found it already, sorry

Sorry, I’m just guessing

Thanks to everyone for helping me out.
The solution from Martin seems to be the best. You can indeed open multiple files this way in Affinity without crashing it.

What a great community here at RT !

cheers

So what’s the simplest command-line which works in RT? Simplest = not using unnecessary quoting or escaping. Is it:
/Applications/Affinity Photo Trial.app

The simplest command line would be
open -a "Affinity Photo Trial"
The quotes are mandatory because of the spaces in the name but otherwise can be omitted, e.g.
open -a RawTherapee
Note that the full path and .app extension are NOT necessary if the app is in the standard /Applications folder where the OS expects it to be.

Calling
/Applications/RawTherapee.app
from the command line will NEVER work, because RawTherapee.app is not an executable file, it’s a directory containing all the executables, runtime libraries, icons, configs etc. that the software needs. (Apple call it a ‘package’, or ‘app bundle’, it requires a specific folder structure and certain files to exist, but it’s still ultimately a directory).

If you want to run the executable itself, than that’s usually placed inside the .app directory in the /Contents/MacOS subdirectory, e.g.
/Applications/RawTherapee.app/Contents/MacOS/rawtherapee
Unfortunately, in my experience trying to run an app by directly calling it’s executable binary usually ends up with some sort of issues, sometimes not running at all. I think when you try to do it that way, not all the required resourced in the .app directory are properly loaded, but I’m not sure.
(it does work sometimes, and of course programs that are just one single executable binary, e.g. ffmpeg, can be used in typical unix command line style

Thanks @ion12, RawPedia updated:
http://rawpedia.rawtherapee.com/Preferences#External_Editor

1 Like

Thanks for updating Rawpedia.
I will post solution on the Affinityforum as well.

Sorry to bring this up again only now, but my mac is in the shop and I finally have a temporary replacement to keep me running and wanted to follow up on a few things

  • I was taught to include full path to .app if it is not in the standard /Applications folder, but realized that it has never crossed my mind to actually try without. I tested and found that
    open -a AppName
    without full path and extension will work regardless of where the app is copied to.
    Even more surprising was to find that the AppName argument is not case sensitive, e.g.
    open -a GIMP, open -a gimp, open -a GimP all opened Users/someArbitraryFolder/GIMP.app
    without any issues, both from the terminal and from RawTherapee.
  • the Gimp.app/Contents/Resources/start path is quite unusual. Maybe it was used years ago when gimp on OS X was still using XQuartz? In any case, current GIMP.app downloaded from gimp.org doesn’t include it.
    But the default hardcoded path to gimp seems to be open -a /Applications/GIMP.app (rtgui/extprog.cc line 253) no? the path listed in Rawpedia seems to be be some fallback option?
    I think
    open -a gimp
    would be a better default hard coded option than open -a /Applications/GIMP.app because it should still work even if GIMP.app is not in the /Applications folder
  • I think there is a typo where it says “Note that you need to enclose it in parentheses” it should be “quotes”.
    The quotes are only necessary when there is a space in the app name

Hope this helps and not just confusing :wink: cheers

The Mac file system is not case sensitive by default, which would explain why case sensitivity is not a factor for the open command.

Thank you @ion12, very helpful! I simplified the GIMP and Photoshop calling code for OS X and updated the documentation:
Simplified OS X GIMP and Photoshop calling code. · Beep6581/RawTherapee@0608ad8 · GitHub
Preferences - RawPedia

Changes pushed to master and gtk3.
Could you verify that the Send to GIMP and Photoshop options work?