Gimp-Forum.net
using Photolab - Batch corrections - Curve - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: using Photolab - Batch corrections - Curve (/Thread-using-Photolab-Batch-corrections-Curve)

Pages: 1 2


using Photolab - Batch corrections - Curve - arodri - 06-23-2024

Good morning

I'm very new using Gimp, so I'm here to ask for your help, for a situation that I'll explain below:

My system - Windows XP SP3

Gimp version - 2.8.22

The situation:

I'm a collector of comic strips from newspapers, and these strips are often not of great quality, which is why I recently discovered Gimp, and more specifically the "Colors - Curves" option, which helped me a lot in cleaning and improving the images (one by one).

Since I often have to improve hundreds of images, I looked for a way to do it in batch processing and discovered "Photolab - Batch corrections - Curve".

Even though I followed the steps explained
1. carry out a procedure on an image
2. Export the definitions of that procedure to an external file


When using "Photolab - Batch corrections - Curve" I invariably get the message, which I attach
I tried it several times, but the situation remains.

As I have a laptop with Windows 7, I thought, maybe because XP is old it doesn't work, but the result is the same.

Could you help me?
My thanks in advance.
Arodri


RE: using Photolab - Batch corrections - Curve - rich2005 - 06-23-2024

Did you get the photolab_curvebatch.py plugin from gimpfr.org ? I tried from there and the download links just went in circles. Fortunately I have the plugin in an archive but it is:

# Version 3.0
# - ported to new curve format used in GIMP-2.6


Is 3.0 the version you are using ? Very old (2009) but it does work in a Win7 / Gimp 2.8 VM

Using Gimp 2.8 put your plugins in C:\Users\"yourname"\.gimp-2.8\plug-ins Better than the system folders. Other than that. It could be the curves file. How did you make that ?

This the plugin working - 60 second animation. http://u.pc.cd/oHyotalK

Alternatives. I would forget WinXP and use Win7 The BIMP batch plugin. Use the old 1.18 version
https://alessandrofrancesconi.it/projects/bimp/


RE: using Photolab - Batch corrections - Curve - arodri - 06-23-2024

Firstly, thank you in advance for your response.

I will try to answer your questions as best as possible.

1. It was actually from the website "http://gimpfr.org/contrib_photolabo.php", that I downloaded the global photolab set -> PhotoLabo-4.0.1.tar.gz

However, I cannot say that it is version 3.0, as it does not reference the plug-in version. That file has 17 folders, and opening PhotoLab Curvebatch only displays the three files that you can check from the image and none of them reference the version.

2. I did what you tell me.

Under Win7
Delete the Photolab...py fle from thw plug-ins
Open Gimp - Close gimp
Copy the file under folder users....myname
Create a new definition file, but the error is the sane

3. The creation of the colors-curve definitions file was followed naturally
1 open image
2 menu colors - curves submenu
3 via graph I defined the desired values
4 I exported the settings to a file (see attached image)

(06-23-2024, 04:28 PM)arodri Wrote: Firstly, thank you in advance for your response.

I will try to answer your questions as best as possible.

1. It was actually from the website "http://gimpfr.org/contrib_photolabo.php", that I downloaded the global photolab set -> PhotoLabo-4.0.1.tar.gz

However, I cannot say that it is version 3.0, as it does not reference the plug-in version. That file has 17 folders, and opening PhotoLab Curvebatch only displays the three files that you can check from the image and none of them reference the version.

2. I did what you tell me.

Under Win7
Delete the Photolab...py fle from thw plug-ins
Open Gimp - Close gimp
Copy the file under folder users....myname
Create a new definition file, but the error is the sane

3. The creation of the colors-curve definitions file was followed naturally
1 open image
2 menu colors - curves submenu
3 via graph I defined the desired values
4 I exported the settings to a file (see attached image)

Ps

With Bimp I don't find the possibility of create definitions to color curve.

Is there any special way to do it?

Thank you


RE: using Photolab - Batch corrections - Curve - rich2005 - 06-23-2024

I do not think I can help much more. For some reason the gimpfr.org site does not download for me.
For information, you can often find the script history if you open it in a text editor. Unfortunately Windows does not have great support.  You have version 4.0.1  I would not worry about it. Edit: Finally got the 4.0.1 7 zip to download ...and ... photolab_curvebatch.py is still version 3 size 5774 B

This the photolab_curvebatch.py file in Win7 / Gimp 2.8

[attachment=12040]

-----
BIMP

The curve file is made exactly as you show.

[attachment=12041]

In BIMP it is in Color Correction -> and the color curve option.

[attachment=12042]

Works here. Difficult to diagnose with these old setups.


RE: using Photolab - Batch corrections - Curve - Ofnuts - 06-23-2024

(06-23-2024, 09:28 AM)arodri Wrote: Good morning

I'm very new using Gimp, so I'm here to ask for your help, for a situation that I'll explain below:

My system - Windows XP SP3

Gimp version - 2.8.22

The situation:

I'm a collector of comic strips from newspapers, and these strips are often not of great quality, which is why I recently discovered Gimp, and more specifically the "Colors - Curves" option, which helped me a lot in cleaning and improving the images (one by one).

Since I often have to improve hundreds of images, I looked for a way to do it in batch processing and discovered "Photolab - Batch corrections - Curve".

Even though I followed the steps explained
1. carry out a procedure on an image
2. Export the definitions of that procedure to an external file


When using "Photolab - Batch corrections - Curve" I invariably get the message, which I attach
I tried it several times, but the situation remains.

As I have a laptop with Windows 7, I thought, maybe because XP is old it doesn't work, but the result is the same.

Could you help me?
My thanks in advance.
Arodri

Possibly a version compatibility problem?  But to help I would need the full python error message. If you start the Gimp error console the message will appear here and you can copy/paste it and even export it to a text file (without the console dialog you can also probably just copy paste the message by doing Ctrl-C in the message box and then pasting elsewhere).


RE: using Photolab - Batch corrections - Curve - arodri - 06-23-2024

Here it goes

Traceback (most recent call last):
File "C:\Programas\GIMP 2\lib\gimp\2.0\python\gimpfu.py", line 736, in response
dialog.res = run_script(params)
File "C:\Programas\GIMP 2\lib\gimp\2.0\python\gimpfu.py", line 361, in run_script
return apply(function, params)
File "C:\Documents and Settings\ar\.gimp-2.8\plug-ins\photolab_curvebatch.py", line 150, in python_fu_curvebatch_xtns
process_files( filepathnames, curvefilename );
File "C:\Documents and Settings\ar\.gimp-2.8\plug-ins\photolab_curvebatch.py", line 126, in process_files
pdb.gimp_curves_spline( imglayer, HISTOGRAM_RED, len(icurvered), icurvered )
RuntimeError: erro de execução


RE: using Photolab - Batch corrections - Curve - rich2005 - 06-24-2024

Just for info: Again using Win7 / Gimp 2.8.20

I can get that error when the image is: Tons de cinzento - grayscale  Not sure about the curve type liso  - straight ? There is a difference in the number of points between smooth and freehand but af far as I can tell both work.

Here the results from a mix of images. RGB and RGB desaturated are processed. The single grayscale fails.

[attachment=12044]

I am sure Ofnuts will fix it for you.


RE: using Photolab - Batch corrections - Curve - Ofnuts - 06-24-2024

Between Rich's  grayscale failure and the OP's error message that happens when trying to tweak a color channel, it seems the script only applies to full-RGB images. A possible fix (untested) that skips the color channels if the image isn't RGB:

[attachment=12046]
 
Used a decent text editor for the fix (not notepad/wordpad, that usually messes the indentation).

Note that the script will still possibly fail on color-indexed images (GIF and some PNG).


RE: using Photolab - Batch corrections - Curve - arodri - 06-24-2024

Thanks again

The result was identical.
I used Word to make the change to the script, but the situation remains.
Out of conscience I attach the altered script, for which I would like to thank you for your help in verifying it.

I may be saying a big mistake, but the new line that you said to implement, has no sequence, that is, after an "if" there is almost always a decision to be made, which doesn't seem to exist... (that would be a mistake on my part?)

Thank you very much anyway

Sorry forget the script


Sorry... the attachment is not allowed

here is the part I change:

*-*

    if len(icurve) >= 4:
      pdb.gimp_curves_spline( imglayer, HISTOGRAM_VALUE, len(icurve), icurve )
    if image.base_type==0
    if len(icurvered) >= 4:
      pdb.gimp_curves_spline( imglayer, HISTOGRAM_RED, len(icurvered), icurvered )
    if len(icurvegreen) >= 4:
      pdb.gimp_curves_spline( imglayer, HISTOGRAM_GREEN, len(icurvegreen), icurvegreen )
    if len(icurveblue) >= 4:
      pdb.gimp_curves_spline( imglayer, HISTOGRAM_BLUE, len(icurveblue), icurveblue )
    #_("Batch")+"/"+
    newfilepathname = os.path.dirname(filepathname) + os.sep + 'CURVE_' + os.path.basename(filepathname) 
    pdb.gimp_file_save( img, imglayer, newfilepathname , newfilepathname )
    pdb.gimp_image_delete( img )

*-*

Just notice I forget the " : " in the new line.

Changed again and the result is the same.


RE: using Photolab - Batch corrections - Curve - Ofnuts - 06-24-2024

(06-24-2024, 01:13 PM)arodri Wrote: Thanks again

The result was identical.
I used Word to make the change to the script, but the situation remains.
Out of conscience I attach the altered script, for which I would like to thank you for your help in verifying it.

I may be saying a big mistake, but the new line that you said to implement, has no sequence, that is, after an "if" there is almost always a decision to be made, which doesn't seem to exist... (that would be a mistake on my part?)

Thank you very much anyway

Sorry forget the script


Sorry... the attachment is not allowed

here is the part I change:

*-*

    if len(icurve) >= 4:
      pdb.gimp_curves_spline( imglayer, HISTOGRAM_VALUE, len(icurve), icurve )
    if image.base_type==0
    if len(icurvered) >= 4:
      pdb.gimp_curves_spline( imglayer, HISTOGRAM_RED, len(icurvered), icurvered )
    if len(icurvegreen) >= 4:
      pdb.gimp_curves_spline( imglayer, HISTOGRAM_GREEN, len(icurvegreen), icurvegreen )
    if len(icurveblue) >= 4:
      pdb.gimp_curves_spline( imglayer, HISTOGRAM_BLUE, len(icurveblue), icurveblue )
    #_("Batch")+"/"+
    newfilepathname = os.path.dirname(filepathname) + os.sep + 'CURVE_' + os.path.basename(filepathname) 
    pdb.gimp_file_save( img, imglayer, newfilepathname , newfilepathname )
    pdb.gimp_image_delete( img )

*-*

Just notice I forget the " : " in the new line.

Changed again and the result is the same.

In Python, the code to execute is the one below the if line, indented (it's the indentation that tell what code is covered by the if), which is why you have to shift the 6 following lines to the right. Also, the line with the if should end with a :.

Code:
    # Uncomment the line below to print the applied curve in format : 0,0,X1,Y1,X2,Y2,...,255,255
    # print "len:", len(icurve), "::courbe :", icurve
    if len(icurve) >= 4:
      pdb.gimp_curves_spline( imglayer, HISTOGRAM_VALUE, len(icurve), icurve )
    if image.base_type==0:
      if len(icurvered) >= 4:
        pdb.gimp_curves_spline( imglayer, HISTOGRAM_RED, len(icurvered), icurvered )
      if len(icurvegreen) >= 4:
        pdb.gimp_curves_spline( imglayer, HISTOGRAM_GREEN, len(icurvegreen), icurvegreen )
      if len(icurveblue) >= 4:
        pdb.gimp_curves_spline( imglayer, HISTOGRAM_BLUE, len(icurveblue), icurveblue )
    #_("Batch")+"/"+
    newfilepathname = os.path.dirname(filepathname) + os.sep + 'CURVE_' + os.path.basename(filepathname)  
    pdb.gimp_file_save( img, imglayer, newfilepathname , newfilepathname )
    pdb.gimp_image_delete( img )
|




"Word" is not a proper editor to edit code. UltradEdit, Notepad++ (which is not Notepad) are proper "free" editors.