The forum

Google NIK Filters on GIMP

Author Replies
eriow Tuesday 3 May 2016 at 17:48
eriowAnonymous

Hello, 

Google made NIK collection available for download with no costs! so I've read this blog post:

http://www.evolware.org/?p=440

But couldn't reproduce on my machine, I am using Ubuntu 14.04.

So I did some trial and error and got up to this point:

https://github.com/ericoporto/NikInGimp

Unfortunately, I wasn't able to findout two things:

1 - how to call playonlinux and ran these scripts from Gimp

2 - how to streamline the steps I've made into a nice playonlinux script that more people could benefit from.

The filters are working on my machine!

MTres19 Tuesday 3 May 2016 at 22:10
MTres19Anonymous

There's a fairly detailed tutorial on the wiki. Unfortunately, it's not exactly well-maintained. It would be a good idea to read through all the different functions in the last chapter just to get familiar. (There are other undocumented ones that you can look through by opening the files in /usr/share/playonlinux/lib, but you probably won't need those for this.) Also take a look at some of the scripts that people have already made. You'll want to replace some commands with their PlayOnLinux equivalents (e.g. replace wget with POL_Download.) Just ask for more help if you need it, and be sure to post your script on the forums before submitting it.

 

While I don't know Python, I could see that that script had hardcoded file paths for relying on things being installed to the .wine folder. I'm not sure I can help you there, but the information on the wiki should be enough to get the filters themselves working. Good luck!

eriow Wednesday 4 May 2016 at 15:46
eriowAnonymous

Hi MTres19!

I am trying to make the script, but currently I have one small problem. In Nautilus, if I right click on a exe installer, it creates a folder with the same name of the file with the contents inside. How can I do that from the command line? This is required for the script to work. Thanks

The script as of right now is here: 

https://github.com/ericoporto/NikInGimp/blob/master/nikplayonlinux.sh

 

Other than that, after the setup is finished, the process GoogleUpdate.exe is ran by the installer for some reason. I have to manually kill it. Right now I am using:

ps -aux | grep GoogleUpdate.exe 

And issuing kill to all the pids listed. If I don't do this, the installer hangs, waiting for it to finish forever.

Edited by eriow

MTres19 Wednesday 4 May 2016 at 23:55
MTres19Anonymous

You might be able to use the cabextract program. For example,

cabextract -d "$GOOGLE_PATH" "$INSTALLER"

But that only works on MS cabinet files. I don't know what kind of file the installer is, although that's what many are. However, according to the previous article you linked to, it should work so long as the directories are already created. Have you actually run your script yet?

As for killing GoogleUpdate.exe, I have to say I don't know an answer. To kill ALL processes in a virtual drive, you incorperate into your script

POL_Wine wineboot -k

But that's not really useful without being able to check to make sure you're not killing the installer too. The only problem with the way you're doing it is possibly (I don't actually know if this happens) running into problems with wineserver not closing or something. It might be easier to simply do something like this:

POL_Wine start /unix "$INSTALLER" # start /unix is not usually recommended but neccessary in this case
POL_Wine_WaitBefore "$TITLE" # Display generic wait message that doesn't block the script from continuing
while [ -n "$(ps -A | grep 'nikcollection-full-1.2.11.exe')" ]; do
# Do nothing
done

POL_Wine wineboot -k # Kill all processes

I hope that works, but I can't be sure. Oh---and edit out those <span>s. Looks like it's a bug in the POL website.

 

Some other general critique:

- I always use #!/bin/bash at the beginning of my scripts. I'm not really sure what /usr/bin/env playonlinux-bash does, since all the functions are normal bash functions imported in the source command farther down.

- Your comments at the top should have the Wine version that you are actually using. (I assume this was just a mistake)

- You should use POL_System_SetArch "x86" instead of export WINEARCH="win32". PlayOnLinux stores the architecture used in a configuration file for each Wineprefix, and if you don't set it it could be set to amd64. (I can't remember what's default.)

- The POL_SetupWindow_wait will immediately be replaced by POL_Wine_WaitBefore or POL_Wine_WaitExit, depending on how you go about it. They can be deleted.

 

Other than that, syntax and all looks good.

Edited by MTres19

eriow Thursday 5 May 2016 at 15:00
eriowAnonymous

Hello MTres19,

I updated the script here: 

https://github.com/ericoporto/NikInGimp/blob/master/nikplayonlinux.sh

I was able to extract the files using file-roller, which is the default Archive Manager for Ubuntu 14.04 (and I think all ubuntus). I couldn't extract the exe with any other, I don't know which would be the playonlinux way to ask for the installation of file-roller if it doesn't exist.

Right now the script is stuck in "Please wait while Google Nik Collection is installed", which I think is when I called POL_Wine_WaitBefore, but POL_Wine start /unix "$INSTALLER" is getting called.

When it happens, I have to go to the terminal and manually kill some stuff. The following command appears to do the job wel:

kill `ps -x | grep services.exe | head -n1 | sed 's/ .*//'`
kill `ps -x | grep GoogleUpdate.exe | head -n1 | sed 's/ .*//'`

Once this is done, file-roller get's called, extract the files, things get copyied to the right folder, shortcuts are created and things works! The software loading time are big, but once they are loaded they work without major problems.

I used PlayOnLinux 4.2.10 .

---

Edit:

The website below has install instruction for both the filters as standalone in playonlinux and a working script to call them from GIMP! If someone can test I will be very happy. Here it's working, but still has the GoogleUpdate.exe issue.

 

https://github.com/ericoporto/NikInGimp

 

Edited by eriow

MTres19 Monday 16 May 2016 at 3:58
MTres19Anonymous

Sorry I'm so late in responding.

I had previously misread your post and didn't realize you had gotten it working with GIMP. Cool! Now onto other things:

First and foremost, you probably don't need to deal with even running the installer. The installer is a 7zip self-extracting archive. That means you can use the 7z command to extract it, and 7z is much more likely to be available than file-roller, and would potentially require less dependencies to be installed. Here's what I'd do to check if 7z is installed.

[ -x "/usr/bin/7z" ] || POL_Debug_Fatal "$(eval_gettext 'The command 7z, which is required for installation, is unavailable. Please install the p7zip-full package.')"

Next, here's what you need to extract it, assuming your current directory is $POL_System_TmpDir and you've made the directory "nik" inside:

7z x -onik -y "$INSTALLER"

This takes a while, so you probably want to add a POL_SetupWindow_WaitBefore before it. Next, you can copy files. I'd warn against copying the entire directory containing the Nik Collection programs, since that includes 64-bit binaries and this is 32-bit Wine. So you'll have to make some directories corrosponding the the ones that the programs might expect.

As you said previously, the name of the folder containing the application files themseves contains invalid characters, so I can't paste them into the message, so you'll have to figure that out on your own. Basically, though, the directory structure that you'll want in the $WINEPREFIX/drive_c is:

$PROGRAMFILES
     |-- Google
            |-- Nik Collection
                      |-- Analog Efex Pro 2
                      |-- Color Efex Pro 4
                      |-- Dfine 2
                      |-- HDR Efex Pro 2
                      |-- Sharpener Pro 3
                      |-- Silver Efex Pro 2
                      |-- Viveza 2

Note the use of $PROGRAMFILES: this is because Wine translates the name of the Program Files folder based on locale.

I'm not sure exactly how your script worked, frankly, because it didn't seem to copy anything to the Program Files directory. (Maybe POL_Shortcut searches throughout the whole drive_c---I can't remember.) But that doesn't really matter anyway.

One more interesting thing: rather than telling the user to drag a file onto the shortcut, here's a nifty trick: use POL_SetupWindow_browse whenever it's not being called from GIMP! Here's what you'd need. (This example is for Dfine 2, the backslashes are escape characters.)

POL_Shortcut_InsertBeforeWine "Dfine 2" "[ -z \"\$@\" ] && POL_SetupWindow_Init"
POL_Shortcut_InsertBeforeWine "Dfine 2" "[ -z \"\$@\" ] && POL_SetupWindow_browse \"$(eval_gettext 'Select a file to open in Dfine 2.')\" \"Dfine 2\""
POL_Shortcut_InsertBeforeWine "Dfine 2" "[ -z \"\$@\" ] && POL_SetupWindow_Close"
POL_Shortcut_InsertBeforeWine "Dfine 2" "[ -z \"\$@\" ] && set -- \"\$APP_ANSWER\""
MTres19 Monday 16 May 2016 at 19:50
MTres19Anonymous

Oh yeah, I'd suggest adding a POL_SetupWindow_question to ask whether the user wants the GIMP plugins to be installed.
eriow Sunday 29 May 2016 at 3:47
eriowAnonymous

Hey MTres19 !

Ok, I tried to use 7z only, and added a POL_SetupWindow_question at the end. The code I proposed to change is here:

https://github.com/ericoporto/NikInGimp/blob/master/nikplayonlinux_proposed.sh

The single problem of not using the installer is that now when I open any filter the first time, there is some missing file from Google somewhere, because I am offered two options to use as trial for 15 days or buying - even though the filters are free. I tried using MELD comparing both PlayOnLinux prefix folders, but this crashes my PC for some reason I don't know.

The good thing is that now I don't have any weird Google proccess running in the background and installing is a loooot quicker this way.

Edited by eriow

eriow Wednesday 15 June 2016 at 4:24
eriowAnonymous

Hey MTres19! 

It's working: https://github.com/ericoporto/NikInGimp/blob/master/nikplayonlinux.sh

How do I submit this script? I also see people pasting the code in a nice way that it only show when clicked, but I don't understand how to do this.

Edited by eriow

MTres19 Wednesday 29 June 2016 at 17:43
MTres19Anonymous

Great! And I'm sorry I haven't been much help lately. I'm glad you got it working. Here's how you add it to the system: http://wiki.playonlinux.com/index.php/How_to_Contribute_a_Script

This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmcayonlinux.com