0% found this document useful (0 votes)
27 views1 page

Gimp Script Adjust Color Levels

This document is a Python script for GIMP that defines a function to adjust color levels in an image. It starts an undo group, modifies the value channel's levels, and ends the undo group to allow for easy undoing of the operation. The script is registered in GIMP with a unique name and description, applicable to RGB and grayscale images.

Uploaded by

khurshid awan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Gimp Script Adjust Color Levels

This document is a Python script for GIMP that defines a function to adjust color levels in an image. It starts an undo group, modifies the value channel's levels, and ends the undo group to allow for easy undoing of the operation. The script is registered in GIMP with a unique name and description, applicable to RGB and grayscale images.

Uploaded by

khurshid awan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

#!

/usr/bin/env python

from gimpfu import *

def adjust_color_levels(image, drawable):

# Start an undo group, so the operation can be undone in one step

pdb.gimp_image_undo_group_start(image)

# Adjust the levels

# Parameters: drawable, channel (0=value, 1=red, 2=green, 3=blue, 4=alpha), low-input, high-input,
gamma, low-output, high-output

pdb.gimp_levels(drawable, 0, 125, 255, 1.0, 0, 255) # Adjust value channel (0)

# End the undo group

pdb.gimp_image_undo_group_end(image)

# Register the script in GIMP

register(

"python_fu_adjust_color_levels", # Unique name for the script

"Adjust Color Levels", # Short description

"Increase low input levels from 0 to 100.", # Long description

"Your Name", "Your Name", "2023", # Author, copyright, date

"<Image>/Image/Adjust Color Levels", # Menu path

"RGB*, GRAY*", # Image types (works on RGB and grayscale images)

[], # No input parameters

[], # No output parameters

adjust_color_levels) # Function to call

main()

You might also like