gimp_bp

Download:

# Notice:
# # Save this script as gimp_bp.py
# # Modify your script BEFORE you import it. reload() might not work like expected.
# #
# Import:
# # Open python-fu console
# # Type: import sys
# # Type: sys.path.append("/path/to/gimp_bp/")
# # Type: import gimp_bp
# # Type: from gimp_bp import *
# #
# Usage:
# # Use the gimp_batch_process() method:
# # gimp_batch_process(input_path, base_filename, output_path, start_at, stop_ap, series_length)
# # e.g.:
# # gimp_bp.gimp_batch_process("/input/path/", "series_", "/output/path/", 1, 10, 2)
# # Will open /input/path/series_01.bmp to series_10.bmp and save it in /output/path/series_01.bmp to series_10.bmp

from gimp import pdb

def gimp_bp_test(str):
	print pdb.gimp_version()

gimp_bp_loaded = 1

def mkfn(length, number):
	stack = "%0"+str(length)+"d"
	return stack % number

def gimp_batch_process(input_path, filename, output_path, start_at, stop_at, series_length):
	#import os
	#list = os.listdir(input_path)
	x = start_at
	while (x <= stop_at):
# open image -----------------------------------------------------------------
		# This script opens bmp files. You can modify this line to open other formats. See gimp python-fu console documentation.
		image = pdb.file_bmp_load(input_path+filename+mkfn(series_length, x)+".bmp", "blank")
# ----------------------------------------------------------------------------
# resize ---------------------------------------------------------------------
		# interpolation: 0 none, 1 linear, 2 cubic, 3 lanczos / scale: new width, new height
		#pdb.gimp_context_set_interpolation(3)
		#pdb.gimp_image_scale(image, 2048, 1152)
# ----------------------------------------------------------------------------
# crop -----------------------------------------------------------------------
		# new width, new height, offset x, offset y
		#pdb.gimp_image_crop(image, 2048, 872, 0, -140)
# ----------------------------------------------------------------------------
		drawable = pdb.gimp_image_get_active_drawable(image)
# blank-----------------------------------------------------------------------
# ----------------------------------------------------------------------------
# color balance --------------------------------------------------------------
		# mode (0/2), preserve-lum (0/1), cyan-red (-100/100), magenta-green (-100/100), yellow-blue( -100/100)
		#pdb.gimp_color_balance(drawable, 0, 0, -0, -0, -0)
		#pdb.gimp_color_balance(drawable, 1, 0, -0, -0, -0)
		#pdb.gimp_color_balance(drawable, 2, 0, -0, -0, -0)
# ----------------------------------------------------------------------------
# hue-saturation -------------------------------------------------------------
		# range (0/6), hue-offset (-180/180), lightness (-100/100), saturation (-100/100)
		#pdb.gimp_hue_saturation(drawable, 0, -0, -0, -0)
# ----------------------------------------------------------------------------
# brightness-contrast --------------------------------------------------------
		# brightness (-127/127), contrast (-127/127)
		#pdb.gimp_brightness_contrast(drawable, -0, -0)
# ----------------------------------------------------------------------------
# levels ---------------------------------------------------------------------
		# channel (0/5), low-input (0/255), high-input (0/255), gamma (0.1/10), low-output (0/255), high-output (0/255)
		#pdb.gimp_levels(drawable, 0, -0, 255, 1.0, -0, 255)
# ----------------------------------------------------------------------------
# desaturate -----------------------------------------------------------------
		# mode (0/2)
		#pdb.gimp_desaturate_full(drawable, 1)
# ----------------------------------------------------------------------------
		pdb.file_bmp_save(image, drawable, output_path+filename+mkfn(series_length, x)+".bmp", "blank")
		pdb.gimp_image_delete(image)
		x = x + 1

documentation.txt -> unavailable, yet. Please be patient.
license.txt

This product requires GIMP software.
http://gimp.org

<<< back