JonBlog
Thoughts on website ideas, PHP and other tech topics, plus going car-free
David’s Batch Processor on OS X
Categories: Mac, Technical

Whilst I am warming to the “Mac way” of doing things, I do like making use of F/OSS where I can. A case in point is processing photos, for which – of course – all free software fans should be using Gimp. Whilst it’s probably not quite Photoshop, it is well featured, powerful, and (as far as I can recall) stable. On Linux it’s all I use for bitmap editing.

Now, on a Mac, the easiest approach to installing Gimp is to use one of the pre-compiled binaries available on the download page – version 2.6.x at the time of writing. However, when it comes to building plugins, it gets a bit tricky. Here’s my use case: I had 118 photographs in JPEG format, taking over 1GB, and wanted to upload them to Flickr. So, I needed to re-size all of them down to 40% to fit into Flickr’s bandwidth limit, and to achieve this fancied trying David’s Batch Processor plugin. But my attempts at installing it dissolved in a pretty shower of CLI errors (note: am pasting from the interwebs here, since I’ve now solved the problem and can’t easily get it to fail again):

$ make install
 Package gimpui-2.0 was not found in the pkg-config search path.
 Perhaps you should add the directory containing `gimpui-2.0.pc'
 to the PKG_CONFIG_PATH environment variable

This was on the same machine as a binary install of 2.6.10. So, it looked like the compiler needed a dependency but couldn’t find it (with hindsight I did wonder if it was available in the binary version, but just required the setting of a suitable path). Anyway I installed the bleeding-edge dev copy (version 2.7.1) via MacPorts, and this fixed the problem. Don’t try this at home if you can help it though: I think it took at least an overnight to compile, around 10 hours at least.

So, this produced a binary, which works really well, on both my stable 2.6.x and my dev 2.7.x. I am not sure how much of a difference it makes, but I’m on OS X 10.6.8. I attach a copy below, to save on duplicated hassle. Simply download, unzip, drop into your “plug-ins” folder and restart; if it’s worked you’ll get a new option at the bottom of your Filters menu. Obviously, if it blows up your house or runs off with your credit card, don’t blame me. But it works here!

Download DBP for Mac OS X

Tip: bear in mind that the binary install of Gimp puts the plugin folder in an odd place (i.e. not in the user’s home). So, if you can’t find your plugin folder, open Edit->Preferences and get the location from Folders->Plugins.

Update 12 Aug

Whether this works on any given Mac probably depends on what libraries are installed in the system already. I’ve found that my binary no longer works for me if I port deactivate the bleeding-edge version of Gimp; accordingly I am having a dig about to see if the plugin can be compiled with dependencies statically linked.

Update 2, 12 Aug

OK, solved it – dependencies are still not statically linked, but instead I’ve brought them in manually. So, here’s how to do it, if the plugin above does not work for you on its own (in particular, crashing was reported in the comments). Download the below zipfile in addition to the plugin above, and put it somewhere permanent (here I’ll assume you’ve put it in your home folder).

unzip ~/gimp-deps.zip
sudo ln -s ~/gimp-deps/* /opt/local/lib

The dependencies are taken from my machine whilst gimp2-devel is activated, and were copied from /opt/local/lib if they started with “libgimp” – so some may strictly be unnecessary. As always, YMMV, but it works for me even after my MacPorts copy is deactivated. Comments welcome, of course.

Download DBP libraries for Mac OS X

43 Comments to “David’s Batch Processor on OS X”

  1. Sanzoghenzo says:

    Hi,
    thanks for your work.
    Unfortunately it seems not to work with OS X 10.6.8 + GIMP 2.6.11. – I’m using Italian as my default language.
    I don’t see any new menu item.
    I tried to place the plugin in all the folders listed in preferences.
    Any hint?
    Thanks in advance

  2. Jon says:

    Hi there Sanzoghenzo,

    I am not an expert, but I wonder if there is a translation problem for DBP, and so the menu option does not appear?

    Still, it is worth double-checking the locations you’ve tried adding the plugin to first – I would think that was the most likely explanation.

    Here is my path for 2.6 (binary install) and 2.7 (macports install) – they appear to happily share it:

    /Users/jon/Library/Application Support/Gimp/plug-ins/dbp

    Unzipped, the ‘dbp’ binary is 191848 bytes in size – does that match what you have? If that doesn’t help, check the permissions on the file as well – you never know if that might help!

  3. Jon says:

    Also, it might be worth checking the Plug-In Browser in the Help menu – and do a search for “Batch”.

    It is a long shot, but if can find it in there but the new menu option does not appear in Filters then it might be worth trying the English version to see if that fixes it (not as ideal as it working in your Italian copy, of course, but it might get it working).

  4. avamk says:

    Hello,
    I got the plugin to work once. But now GIMP tells me the plugin crashed everytime I try to start it. I am running GIMP 2.6.11 on Mac OS X 10.6.8.
    I tried to reinstall GIMP 2.6.11 via Macports and from http://gimp.lisanet.de/Website/News/News.html, but now the plugin is not even showing up.
    I double checked that the plugin file is in the right folder, didn’t help.
    Can you provide any suggestions? Thanks.

  5. Jon says:

    Hi avamk,

    * What’s the path of your plugin folder, as per your Preferences pane?
    * Have you confirmed that the uncompressed file is of the size I stated above?
    * Make sure you don’t leave the zip file in the plugins folder. It doesn’t seem to affect my system, but if it’s not working for you, it would be the first thing I’d try.
    * Have you checked the user/group/permissions on the plugin file? It’s a long shot, but worth checking.

    Both: I was going to suggest running gimp with “gimp –verbose”, but with my (working) plugin there doesn’t appear to be any plugin output at all upon start-up.

  6. Jon says:

    Incidentally, there may be something about 2.6.11 that changes how a plugin is compiled (though I’d think it unlikely, given that the 2.7.x works fine).

    If you get a crash when you use the menu option reliably, then try this. Start up gimp on the command line, as above, and then note the CLI output prior to the crash. You will then have something to search for on the web – for which a solution may already exist :)

    (Edit: oh yes – if you have the macports Gimp installed, compile the plugin yourself; it is very quick and easy!)

    • avamk says:

      Ah yes, it works now. Just to confirm, you are using the Macports version, too, right? Thanks!

      • Jon says:

        No probs.

        I’m using both, sort of. I had to install the macports version in order to compile the plugin, but it seems to work with the binary 2.6.x version as well. (Perhaps if I uninstall the macports version, the plugin will stop working in the binary version – I should investigate that!)

  7. Jon says:

    General update – I uninstalled gimp2-devel (my macports version) and the plugin now crashes every time I try to launch it from the binary version of Gimp. Bah! I presume it is the same as this problem, experienced when I execute the plugin from the CLI:

    dyld: Library not loaded: /opt/local/lib/libgimpui-2.0.0.dylib
    Referenced from: /Users/jon/Library/Application Support/Gimp/plug-ins/./dbp
    Reason: image not found
    Trace/BPT trap

    I am presently re-installing gimp via macports, and will see if I can compile the plugin with all dependencies included. Watch this space!

    • avamk says:

      Looking forward to it! Thanks.

    • Sanzoghenzo says:

      Hi,
      sorry for not posting before but I got the same error.
      I don’t think you have to build all the dependencies, because the library is present inside gimp.app package, in Contents/Resources/lib.
      I’m not an expert so I don’t know how to link to that lib, though!
      Thanks for your work!

      • Jon says:

        You’re right, the libraries are indeed all inside the Gimp.app package; however, if you have the same situation as me, they are of too early a version. That is, if you download the binary-only copy of Gimp, the libraries will be for 2.6, but since I used 2.7 from MacPorts to provide the dependencies, it will require the 2.7 libraries (using the 2.6 versions will result in a run-time error explaining this).

        I could build DBP against the 2.6 version, but I would need the right C header files I think, in the right place, which may be somewhat beyond my understanding!

        Anyway, if you don’t have macports and/or you don’t want the hassle of building 2.7 yourself, try my “Update 2″ above – I think it will fix it for you.

  8. Jon says:

    Yikes, I now appear to have some macports problems. If anyone has any ideas, whack ‘em on this here StackExchange question!

  9. avamk says:

    Thanks so much for the updates! This will be so useful for so many people… :)

  10. Todd says:

    I can’t tell you how much time you just saved me! I have the plugin working just fine in 10.7.1 — needed the dbp libraries. Thanks!

  11. Rich says:

    Jon,

    I unpacked and installed the DBP binary in my GIMP plugins folder. And DBP libraries in my Home folder. But it doesn’t show up under Filters in GIMP. Did I miss a step? Any suggestions? My GIMP version is 2.6.11. My Mac is 10.6.8.

    Any help would be greatly appreciated.

  12. Jon says:

    Hi Rich,

    I’d expect that to work – I am running 10.6.8 as well.

    The libraries need to show up in /opt/local/lib/* – hence my approach of symlinking them from ~/gimp-deps. Did you do the symlink as well?

    If that doesn’t work, try moving them from ~/gimp-deps/* to /opt/local/lib/* and restarting gimp. Play around with permissions as well, in case gimp can’t see the libraries.

    Failing that, try executing the dbp plugin from the command line, and tell us what you get (it won’t run it correctly, but it will help us diagnose if there is a problem with it).

  13. Rich says:

    Jon,

    Thanks for the reply. I think it’s getting beyond my technical skills at this point, but I did manage to set up Automater to do what I need. Thanks for your help.

  14. Ken says:

    I have OS X 10.7. I downloaded GIMP (2.6.11) and both the links in Jon’s original blog. I’m getting the error message discussed earlier:
    Library not loaded: /opt/local/lib/libgtk-x11-2.0.0.dylib
    Referenced from: /Users/USER/Library/Application Support/Gimp/*/dbp
    Reason: image not found
    Lion’s X11 is version 2.6.3. Would it screw up Lion if I stored X11 2.0 in /opt/local/lib? If not, where can I find it to download? If it would mess things up, is there any way to make things work with Lion?

    Thanks.

    • Jon says:

      Hi Ken,

      My limited understanding is that if the file “/opt/local/lib/libgtk-x11-2.0.0.dylib” does not already exist on your machine, then it is fine to put a copy there to satisfy the dependency in my dbp binary. However there could be quite a list of dependencies even if that one does work! The best approach would be to install macports and install the dev version of Gimp, which will load all the stuff you need to compile dbp on Lion.

      However bear in mind the recompilation for this is an overnight job! Would it help if I were to put up the libgtk-x11-2.0.0 files in a tarball? They may not work, but it could be worth a try.

  15. Ken says:

    Jon, Thanks for the quick response. Since just installing 2.0.0 is the simpler thing, I would appreciate you bundling that up for me. If it doesn’t solve the problem it would be easy to undo. I could then move to the macports approach. Thanks.

    • Jon says:

      No probs. Try this:

      cd ~
      wget http://blog.jondh.me.uk/wp-content/uploads/2011/11/libgtk-x11-2.0.0.zip
      unzip libgtk-x11-2.0.0.zip -d libgtk-x11-2.0.0
      sudo ln -s libgtk-x11-2.0.0/* /opt/local/lib
      cd /opt/local/lib
      sudo ln -s libgtk-x11-2.0.0.dylib libgtk-x11-2.0.dylib

      If that works for you, I will add it as an update to the post for Lion users generally. (Edit: incidentally I have just chosen these three files plus a symlink as they are very similarly named – there may be other deps as well, I guess we’ll soon find out!)

  16. Ken says:

    No joy. I get this message:

    Dyld Error Message:
    Library not loaded: /opt/local/lib/libgtk-x11-2.0.0.dylib
    Referenced from: /Users/USER/Library/Application Support/Gimp/*/dbp
    Reason: image not found

    I checked: the X11 files are actually in /opt/local/lib. They all have permissions rwxr-xr-x.

    Jon, you have any other ideas before I move to Plan B and go the macports route.

    Ken

    • Jon says:

      Hmm, running out of ideas!

      My plugin is in a different location to yours though, might be worth moving it thus: /Users/jon/.gimp-2.7/plug-ins/dbp (obviously switch the username and the Gimp version).

      Also, try switching the permissions to 777 to be on the safe side in /opt/local/lib (although mine are 644 and 655, so yours should be ok).

      How do you get the error message, btw? I found the best way to debug dependencies is to run the binary from the command line, as if it were an ordinary executable. If it won’t start up, it will output errors; if all is good it will say “X is a GIMP plug-in and must be run by GIMP to be used”.

      If you are still stuck, I’d recommend Apple/StackExchange, as there’s a bunch of very knowledgeable experts there. If you get some external help, please do post what you find here – I expect it would be useful generally.

  17. Ken says:

    I found the error text by looking at the Console and finding an incident with the right date-time stamp.

    Given that GIMP finds everything else in the Application Support folder (which it created at install), I can’t see why it would go looking for a .gimp-2.6.11 folder. There are other plug-ins in that folder that it finds.

    In trying to change permissions I just realized that the only libgtk files in the directory are symbolic links/aliases. But when I do a Get Info on them they don’t point to anything. That would explain why GIMP is not a happy camper.

    I did this sleuthing in Finder, while I used the command line to do the install per the instructions you gave. What I don’t know is if in installing something else yesterday the files got deleted somehow or if they were never there to begin with.

    I am not a Unix guy, so I don’t know what might happen if I try to rerun your install or if I try to do all the steps in Finder rather than Terminal.

    Ken

    • Jon says:

      > I found the error text by looking at the Console

      Right, that would be a good way to do it.

      > There are other plug-ins in that folder that it finds.

      Fair enough, that’s a good check.

      > But when I do a Get Info on them they don’t
      > point to anything. That would explain why
      > GIMP is not a happy camper.

      I’d have thought it would cope with that – it is fine at least with the libraries included in the main body of my post. But you could always delete any symlinks you’ve created and swap them with their real equivalents. The only reason I like to use symlinks is that it reminds me what is non-standard on my Mac, so if I break something I can revert easily.

  18. Ken says:

    I put the files back into lib. Now I see that GIMP is complaining because it can’t find a libgdk file: Library not loaded: /opt/local/lib/libgdk-x11-2.0.0.dylib. Those are also GIMP dependencies? I’m thinking that following the macports road might be the quickest way to getting everything I need. Do you recommend 2.7.3?

    Ken

  19. Ken says:

    Throwin’ the towel. Macports couldn’t get all the dependencies to build 2.6.11. Interestingly, one of the many was the gtk files the precompiled version was looking for. So I guess I’ll live with GIMP with DBP. Maybe I teach myself scripting and do it myself.

    Thanks for your help.

    Ken

    • Jon says:

      No probs.

      I think you were taking the right path to switch to the Macports approach – we could have been here until the cows come home otherwise (you find a dep, I bundle it up, post it on the blog, you find another dep… ;-) ).

      I suggest your next port of call is to pick out the error message from the Macports compilation, and put it on StackOverflow or whatever Macports help channel. I’d be surprised if Gimp via Macports won’t work on Lion!

      Still, you could always use ImageMagick instead – does batch operations nicely and is very flexible. Maybe that would suit your requirements.

  20. Lili Lith says:

    do it work with gimp 2.8 ? I put the plug-in in the gimp plug-in folder, but it doesn’t work vv. (I have a mac 10.6.8)

    • Jon says:

      Hi Lili. I’m not sure – I’m still on 2.6.10. I’ll upgrade at some point to see if it works :)

      You’re on the same OS version as me however, so I would imagine it should be okay (the problems above are likely to be due to OS dependencies). Try launching Gimp from the command line (/Applications/Gimp.app/Contents/Resources/bin/gimp –verbose) and see if you get any errors in the output.

      Also, do you get a menu option Filters->Batch Process… ?

      • Sam says:

        Hi,
        I am having a similar problem as Lili. I put the file in my plug in folder and it is not showing up in my drop down menu. I am still using 2.6.10 though. I am new to gimp and the plug-ins so any help would be great!
        thanks,
        sam

  21. Wiebke says:

    Hi.
    I managed to install your nice scripts, so that the plugin will show up in Gimp but unfortunately in Gimp 2.8.0 it leads to the following error: Could not execute plug-in “dbp”
    (/Users/wiebkes/Library/Application Support/Gimp/plug-ins/dbp)
    because it uses an obsolete version of the plug-in protocol.

    I suppose that means that David’s Batch Processor can no longer be used in the newest Gimp-versions… which is sad.

    Thanks for your hard work Jon to make the Batch Processor work on a Mac though.

  22. Sam says:

    Is there a guide somewhere for ppl who don’t know any programming lingo? I unzipped the file, moved it into the designated folder for plugins, but nothing shows there… not sure what to do or how to do it

    • Jon says:

      Hi Sam, apologies for late reply.

      I don’t have time to assist right now, but another solution is to run a copy of Windows in a virtual machine, such as VirtualBox. Not as nice as running it natively on a Mac, but installing the plugin might be easier.

  23. Lex says:

    Hey Jon,

    Thank you, so much, for sharing the information (and the binary).

    You ROCK!

    ~ Lex

Leave a Reply