Post Reply 

Command line for exposure blend

Dec 22, 2012, 01:48 (This post was last modified: Dec 22, 2012 01:49 by pannayar.)
Post: #1
Command line for exposure blend
New gimp user here. I have been using the exposure blend plugin and have been getting good results. However when I have 5 or 7 bracketed shots , there is a bit of trying various combinations of the dark and bright exposures to get the most pleasing one eventually. This is getting a bit cumbersome. Is there a command line to do the same thing (and save the output as a jpeg) so I can run a bunch of commands and just look at all the outputs. That would make life a lot simpler. Thanks a lot!
Find all posts by this user
Quote this message in a reply
Dec 22, 2012, 11:26
Post: #2
RE: Command line for exposure blend
Have been trying various searches to see if I can find something. No luck.

I don't know if I need a new script. I think I need to come up with the correct way of calling (from the shell command prompt) the exposure-blend* scm files (in the gimp scripts folder) with the right parameters passed to it...

Any help will be highly appreciated. Thanks.
Find all posts by this user
Quote this message in a reply
Dec 22, 2012, 11:28
Post: #3
RE: Command line for exposure blend
7 shots and just a yay/nay inclusion choices per shot: 128 pictures to check (2^7). With 3 choices instead of 2 per shot: 3^7=2187 combinations (even at 5 shots: 3^5=243 pictures). You also need to have pictures with exact overlap.

And even if you can quickly weed out a good deal of these, comparing the core 20-30 pictures two by two is also going to take some time.

The exposure blend plugin is OK with two or three shots, beyond that you have better look into auto-composition software (such as Luminance HDR (aka Qtpfsgui)). Obtaining a natural blend with it is just a matter of using reasnable settings.

Otherwise, to answer your original question, to have a command line do it is possible if you find someone to write the required glue script.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Dec 22, 2012, 12:13 (This post was last modified: Dec 23, 2012 02:22 by pannayar.)
Post: #4
RE: Command line for exposure blend
I did not quite follow your math. Let me explain a bit of my situation.

We use (in the exposure blend plugin's GUI mode) 3 shots - a normal (N), dark (D) and bright (B) shot. I take 5 shots, call them D2, D1, N, B1, B2 (at -2, -1, 0, +1, +2 EV). In a simple case, I want to try the results with these 4 combinations.

[D2, N, B2]
[D1, N, B1]
[D2, N, B1]
[D1, N, B2]

And possibly others like [D2, D1, N] in the 5 shot case. These combinations grow to may be around 10 or so with 7 shots. Not to 2^7 or 3^7 or such huge numbers.

Now when I have 7 shots, I visually try to judge which selection of the [D, N, B] from the 7 might give me a good result. Instead if I can just batch it all and see all the outputs, that will make the work much less repetitive and less cumbersome (if I have say 5 or 7 shots each for 20 different pics...)

Thanks!
Find all posts by this user
Quote this message in a reply
Dec 22, 2012, 12:34
Post: #5
RE: Command line for exposure blend
More reading tells me something along these lines is what I need.

gimp -i -b '(script-fu-exposure-blend img_normal img_dark img_bright ... )' ...

If someone can help me with filling in the "..." portions in the above line, I think I will be getting closer to what I need.

Thanks
Find all posts by this user
Quote this message in a reply
Dec 22, 2012, 14:22
Post: #6
RE: Command line for exposure blend
It's a bit more complicated than this because I don't see the plugin saving the file so you have to write a small script to call the exposure blend and save the result.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Dec 22, 2012, 14:31 (This post was last modified: Dec 22, 2012 14:55 by pannayar.)
Post: #7
RE: Command line for exposure blend
(Dec 22, 2012 14:22)ofnuts Wrote:  It's a bit more complicated than this because I don't see the plugin saving the file so you have to write a small script to call the exposure blend and save the result.

Yes. In the GUI mode, I export the output to a JPEG which is a independent process I guess. Can someone help me there?

As of now, I am having trouble even passing the correct parameters to the blend.scm ... (after cd -ing into the folder than contain the images N/D/B.jpg).

gimp-2.8.exe -i -b '(script-fu-exposure-blend img_f ... )'

What parameters need to be passed for img_f, img_dark_f etc?

Here is a error screenshot.

Thanks


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
Dec 22, 2012, 18:25
Post: #8
RE: Command line for exposure blend
First, you are on windows, so don't believe everything you see about the batch call because the syntax in Windows is different. Everything that should be passed as a single parameter should be in double quotes.

The first three parameters to the script are file names, the rest are the options you see in the dialog when used in interactive mode (for those with a choice, use 0,1,2...).

To save the image at the end, you have to retrieve the image created. If there is no other image loaded in Gimp at that point, that will be the first in the list. But you need a short script for this that you call instead of calling the plugin directly. Parameters to the plugin can be either passed from those you give in the command line, or "hardcoded" in your script. You script will need one more parameter: the name of the output file (unless it contains logic to make one up from the input files).

You can test bits of code using the script-fu console.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Dec 22, 2012, 18:52 (This post was last modified: Dec 22, 2012 19:00 by paynekj.)
Post: #9
RE: Command line for exposure blend
I'm working on the assumption that the script you are referring to is the one from the registry: http://registry.gimp.org/node/6708

As ofnuts points out the command line for running gimp in batch mode is different. You cannot use single quotes, so the command would become something like:

Code:
"C:\Program Files\GIMP-2.0\bin\gimp-2.6.exe" -i -b "(script-fu-exposure-blend \"N_file.jpg\" \"D1.jpg\" \"B1.jpg\" ....)" -b "(gimp-quit 0)"

Also as ofnuts says, the standard script will load 3 files and create an image in an active instance of GIMP, so some sort of wrapper will need to be written to save the resulting image as that's not possible to do on a simple command line.

I'll have a quick look at doing that. - and I see that it will require the script to be modified as it doesn't pass out a reference to the newly created image.

Kevin
Find all posts by this user
Quote this message in a reply
Dec 22, 2012, 20:37
Post: #10
RE: Command line for exposure blend
(Dec 22, 2012 18:52)paynekj Wrote:  I'll have a quick look at doing that. - and I see that it will require the script to be modified as it doesn't pass out a reference to the newly created image.
You can make the assumption that the image will be the only one in the image list...

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Dec 22, 2012, 21:26 (This post was last modified: Dec 22, 2012 21:28 by pannayar.)
Post: #11
RE: Command line for exposure blend
Thanks a lot for the help folks.

Yes this is the plugin I am working with. http://registry.gimp.org/node/6708

I thought the parameters were just file names, but did not use double quotes.

Now, I have these 3 in a folder, and I did.

$ ls
B.jpg D.jpg N.jpg

$ gimp-2.8.exe -i -b "(script-fu-exposure-blend \"N.jpg\" \"D.jpg\" \"B.jpg\")" -b "(gimp-quit 0)"

I thought the other parameters (blur-rad, blur-thresh etc) will be defaulted but it seems like all of them (as in this gui) need to be passed. I don't know what values to pass for some - "TRUE" / "FALSE" for the 'Dark Takes Precedence' ... ?


Attached File(s) Thumbnail(s)
       
Find all posts by this user
Quote this message in a reply
Dec 22, 2012, 23:30
Post: #12
RE: Command line for exposure blend
I at least found the parameters now.

gimp-2.8.exe -i -b "(script-fu-exposure-blend \"N.jpg\" \"D.jpg\" \"B.jpg\" 8 "Gaussian/None" "Dark" "Bright \(inverted\)" FALSE FALSE)" -b "(gimp-quit 0)"

Do we have to do the -b "(gimp-quit 0)"
I mean, if there are 100s of files to be processed ,would it be better to not close it and reopen it each time.


-----
batch command executed successfully...

GIMP-Error: Calling error for procedure 'gimp-image-get-active-layer':
Procedure 'gimp-image-get-active-layer' has been called with an invalid ID for a
rgument 'image'. Most likely a plug-in is trying to work on an image that doesn'
t exist any longer.

script-fu.exe-Warning: Error while loading C:\Program Files\GIMP 2\share\gimp\2.
0\scripts\exposure-blend-1.3c.scm:

Error: (C:\Program Files\GIMP 2\share\gimp\2.0\scripts\exposure-blend-1.3c.scm :
627) Procedure execution of gimp-image-get-active-layer failed on invalid input
arguments: Procedure 'gimp-image-get-active-layer' has been called with an inva
lid ID for argument 'image'. Most likely a plug-in is trying to work on an image
that doesn't exist any longer.
Find all posts by this user
Quote this message in a reply
Dec 23, 2012, 01:07
Post: #13
RE: Command line for exposure blend
(Dec 22, 2012 23:30)pannayar Wrote:  I at least found the parameters now.

gimp-2.8.exe -i -b "(script-fu-exposure-blend \"N.jpg\" \"D.jpg\" \"B.jpg\" 8 "Gaussian/None" "Dark" "Bright \(inverted\)" FALSE FALSE)" -b "(gimp-quit 0)"
Me things the parameters there are more like:
Code:
\"N.jpg\" \"D.jpg\" \"B.jpg\" 8 0 0 0 FALSE FALSE"
(because the plugins are told in which position is the selector, not what it was displaying (which would be very hard to handle for translated versions)

(Dec 22, 2012 23:30)pannayar Wrote:  Do we have to do the -b "(gimp-quit 0)"
I mean, if there are 100s of files to be processed ,would it be better to not close it and reopen it each time.
Excellent remark... it's better to write a script that would just take a directory, and iterate in the files in it, calling the plugin and saving the result.

You can write the scripts in Python, a language with which can you can be more familiar already (or with which you'll get familiar a lot faster).

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Dec 23, 2012, 02:13
Post: #14
RE: Command line for exposure blend
(Dec 23, 2012 01:07)ofnuts Wrote:  Me things the parameters there are more like:
Code:
\"N.jpg\" \"D.jpg\" \"B.jpg\" 8 0 0 0 FALSE FALSE"

That gave me an error saying 'not enough arguments'.

(Dec 23, 2012 01:07)ofnuts Wrote:  Excellent remark... it's better to write a script that would just take a directory, and iterate in the files in it, calling the plugin and saving the result.

You can write the scripts in Python, a language with which can you can be more familiar already (or with which you'll get familiar a lot faster).

I am a little familiar with perl. Not python. If someone can help me with the rest of the remaining steps, it would be great.

Thanks.
Find all posts by this user
Quote this message in a reply
Dec 23, 2012, 09:11
Post: #15
RE: Command line for exposure blend
I'm not going to be able to do anything on this over Christmas. I'll pick it up again later if needed.

Kevin
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  How to close gimp with batch command? flixe 1 298 Jun 19, 2017 12:29
Last Post: ythgilb
  Need help in running a gui script-fu via command line eyalzek 2 360 Oct 4, 2014 14:05
Last Post: eyalzek
  script-fu ok in gimp, not in commad line dominique 1 414 Sep 28, 2014 03:18
Last Post: dominique
  how to use the smudge tool in command line or script ? mygost 26 1,757 Mar 6, 2014 16:45
Last Post: mygost
  Bash command line to open two images into GIMP layers lwhistler 2 1,176 Sep 23, 2013 08:18
Last Post: rich2005

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS