Created
November 8, 2025 01:41
-
-
Save MonteLogic/88dfaccfd713ec363a4fba78877f8f9b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> def run_my_curves_final_fix(): | |
| ... from gi.repository import Gimp | |
| ... curve_points_255 = [ (0, 0), (200, 141), (255, 255) ] | |
| ... flat_curve_float = [] | |
| ... for input_val, output_val in curve_points_255: | |
| ... flat_curve_float.append(input_val / 255.0) | |
| ... flat_curve_float.append(output_val / 255.0) | |
| ... channel = Gimp.HistogramChannel.VALUE | |
| ... images = Gimp.get_images() | |
| ... if images: | |
| ... image = images[0] | |
| ... print("Processing image: " + image.get_file().get_path()) | |
| ... image.undo_group_start() | |
| ... try: | |
| ... count = 0 | |
| ... for layer in image.get_layers(): | |
| ... if layer.get_visible(): | |
| ... # --- THIS IS THE FIX --- | |
| ... # Removed the 'num_points' argument | |
| ... layer.curves_spline(channel, flat_curve_float) | |
| ... count += 1 | |
| ... finally: | |
| ... image.undo_group_end() | |
| ... print("Done. Applied spline curve to " + str(count) + " visible layers.") | |
| ... Gimp.displays_flush() | |
| ... else: | |
| ... print("Error: No open images found.") | |
| ... | |
| >>> | |
| >>> run_my_curves_final_fix() | |
| Processing image: /home/monte/Downloads/berg-writings/edit-5-multiple-layers-full-page-cropped - the-creator-in-the-creation-5.xcf | |
| Done. Applied spline curve to 43 visible layers. | |
| >>> | |
| >>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment